Skip to main content
19 events
when toggle format what by license comment
May 2, 2015 at 19:20 history edited Caridorc CC BY-SA 3.0
meaningful title
Sep 13, 2013 at 15:46 comment added Seif Migrated should contain at maximum 200 value all of them are 4 byte .
Sep 13, 2013 at 15:44 history edited Seif CC BY-SA 3.0
added 73 characters in body
S Sep 10, 2013 at 7:46 history suggested 200_success
Added performance tag
Sep 10, 2013 at 6:58 review Suggested edits
S Sep 10, 2013 at 7:46
Sep 9, 2013 at 17:09 comment added chux In some embedded systems, testing against 0 is marginally faster than testing against a constant, so reverse the for loop: for(i=n; --i >= 0; )
Sep 9, 2013 at 16:36 answer added ams timeline score: 0
Sep 9, 2013 at 15:52 answer added Sergey L. timeline score: 1
Sep 9, 2013 at 15:48 comment added Marko The key to optimising is usually to not optimise unless you have empirical evidence that it is necessary. In saying that, understanding the complexity and memory consumption of various types of containers is very worthwhile. For instance, the using a hash-table here with 2 items is a massive overhead.
Sep 9, 2013 at 15:47 history migrated from stackoverflow.com (revisions)
Sep 9, 2013 at 15:46 comment added Hot Licks @Kip9000 - For two elements?? Any decent compiler will unroll the loop and have it done before you've figured your first hash value.
Sep 9, 2013 at 15:45 comment added Hot Licks Dunno -- what compiler optimization option did you use?
Sep 9, 2013 at 15:45 comment added grep Dialecticus: Actually strcmp will scan through characters, and if the first one does not match, it will stop immediately.
Sep 9, 2013 at 15:43 comment added GManNickG Get a profiler and find out.
Sep 9, 2013 at 15:42 comment added Dialecticus Actually, if there are only two items in the array it would be better to check for the first character in codeB and based on it compare the string with only one viable item in the array.
Sep 9, 2013 at 15:41 answer added Frerich Raabe timeline score: 0
Sep 9, 2013 at 15:40 comment added Dialecticus If there are only two items in Migrated array they yes, it is optimized, but if there are thousands of items then there are better ways to code it.
Sep 9, 2013 at 15:40 comment added Kip9000 You should use a hash table.
Sep 9, 2013 at 15:37 history asked Seif CC BY-SA 3.0