Hi All,
In my c++ application, I need to use 60 string arrays with the size of 16. If I create this much of arrays, will the performance of my application be affected?
8 1795
So you are creating something like:
This is 60 * 16 bytes of memory, or 960 bytes of memory - in other words, practically nothing. It is relatively large compared to other variables such as a single int, but I don't think it will be big enough to seriously affect your program's performance time.
So you are creating something like:
This is 60 * 16 bytes of memory, or 960 bytes of memory - in other words, practically nothing. It is relatively large compared to other variables such as a single int, but I don't think it will be big enough to seriously affect your program's performance time.
I have to create like the following:
string str1[16];
.
.
.
string str60[16];
What you are creating here are 60 arrays of 16 strings. Are you sure this is what you require? I had assumed you meant you needed 60 strings that would hold 16 characters each, not 60 string arrays of 16 strings each.
What you are creating here are 60 arrays of 16 strings. Are you sure this is what you require? I had assumed you meant you needed 60 strings that would hold 16 characters each, not 60 string arrays of 16 strings each.
yes, I am sure about that. now please say, whether the performance will be affected or not?
Well, this will be 60 arrays * 16 entries * 4 bytes, which is 3840 bytes - still not a huge amount. But might I suggest instead of using - str1[16];
-
str2[16];
-
...
-
str60[16];
you may consider using a 2D array:
Well, this will be 60 arrays * 16 entries * 4 bytes, which is 3840 bytes - still not a huge amount. But might I suggest instead of using - str1[16];
-
str2[16];
-
...
-
str60[16];
you may consider using a 2D array:
Thank you very much!!!
Banfa 9,065
Expert Mod 8TB
Well, this will be 60 arrays * 16 entries * 4 bytes.
Strictly speaking if using ~4kbytes of memory is a performance issue is platform dependent.
For instance on a PC with 1GByte of RAM then 4kbytes of memory is negligable, however on a microprocessor with 32kbyte of RAM 4kbyte is 12.5% of available memory and could be very significant.
How about just using
It would work in C++,
would there be a performance issue?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Java script Dude |
last post by:
Some programmers prefer to stay with native level data structures such
as string arrays instead of using Object based data structures such as
ArrayList.
From and efficiency point of view. Are...
|
by: Don Starr |
last post by:
When applied to a string literal, is the sizeof operator supposed to return the size of the string
(including nul), or the size of a pointer?
For example, assuming a char is 1 byte and a char *...
|
by: Simon Schaap |
last post by:
Hello,
I have encountered a strange problem and I hope you can help me to
understand it. What I want to do is to pass an array of chars to a
function that will split it up (on every location where...
|
by: Chad Myers |
last post by:
I've been perf testing an application of mine and I've noticed that there
are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String
instances being created.
I've done some...
|
by: jortizclaver |
last post by:
Hi,
I'm about to develop a new framework for my corporative applications
and my first decision point is what kind of strings to use: std::string
or classical C char*.
Performance in my system...
|
by: greenflame |
last post by:
I want to make a function that does the following. I will call it
thefunc for short.
'||Char>>'
I tried the following
def thefunc(s):
s = "||" + s + ">>"
|
by: rohitpatel9999 |
last post by:
Hi
While developing any software, developer need to think about it's
possible enhancement for international usage and considering UNICODE.
I have read many nice articles/items in advanced C++...
|
by: jerry.upstatenyguy |
last post by:
I am really stuck on this. I am trying to write a string array
containing a "word" and a "definition" to a class called Entry.
Ultimately this will end up in another class called dictionary. No,...
|
by: SneakyElf |
last post by:
i am very green with c++ so i get stuck on very simple things
anyway, i need to write a program that would
read data from file (containing names of tv shows and their networks)
one line at a time...
|
by: shapper |
last post by:
Hello,
I have two arrays of strings, s1 and s2:
s1 = "london, lisbon, paris, newyork"
s2 = "lisbon, yellow, France"
s2 will have only one item included in s1.
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |