Click here to Skip to main content
15,880,608 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralPerformance woes. I'm appalled. Pin
honey the codewitch26-Dec-20 4:46
mvahoney the codewitch26-Dec-20 4:46 
GeneralRe: Performance woes. I'm appalled. Pin
harold aptroot26-Dec-20 4:58
harold aptroot26-Dec-20 4:58 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch26-Dec-20 5:28
mvahoney the codewitch26-Dec-20 5:28 
GeneralRe: Performance woes. I'm appalled. Pin
Daniel Pfeffer26-Dec-20 7:08
professionalDaniel Pfeffer26-Dec-20 7:08 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch26-Dec-20 8:12
mvahoney the codewitch26-Dec-20 8:12 
GeneralRe: Performance woes. I'm appalled. Pin
trønderen26-Dec-20 9:01
trønderen26-Dec-20 9:01 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch26-Dec-20 10:19
mvahoney the codewitch26-Dec-20 10:19 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch26-Dec-20 16:57
mvahoney the codewitch26-Dec-20 16:57 
Switching on characters is killing performance.

C++
switch(ch) {
    case '\t': // tab
        m_column+=TabWidth; // tabwidth is static const
        break;
    case '\n': // newline
        ++m_line;
        // fall through
    case '\r': // carriage return
        m_column=0;
        break;
    default:
        ++m_column;
        break;
}


This loses me 7-8MB/s in throughput on my machine pretty consistently. The problem is I switch on characters everywhere as this is a JSON parser. I can reduce some of my comparisons but not a lot of them because of the way my code is structured. The only other thing I can think of right now is building my own jump table schemes but I really don't want to do that so I'm trying to come up with something else.
Real programmers use butterflies

GeneralRe: Performance woes. I'm appalled. Pin
trønderen26-Dec-20 18:50
trønderen26-Dec-20 18:50 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch27-Dec-20 0:55
mvahoney the codewitch27-Dec-20 0:55 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch27-Dec-20 1:05
mvahoney the codewitch27-Dec-20 1:05 
GeneralRe: Performance woes. I'm appalled. Pin
Josh Gray228-Dec-20 1:47
Josh Gray228-Dec-20 1:47 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch28-Dec-20 2:02
mvahoney the codewitch28-Dec-20 2:02 
GeneralRe: Performance woes. I'm appalled. Pin
Jörgen Andersson27-Dec-20 3:45
professionalJörgen Andersson27-Dec-20 3:45 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch27-Dec-20 4:07
mvahoney the codewitch27-Dec-20 4:07 
GeneralRe: Performance woes. I'm appalled. Pin
Jörgen Andersson27-Dec-20 4:13
professionalJörgen Andersson27-Dec-20 4:13 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch27-Dec-20 4:31
mvahoney the codewitch27-Dec-20 4:31 
GeneralRe: Performance woes. I'm appalled. Pin
Jörgen Andersson27-Dec-20 4:51
professionalJörgen Andersson27-Dec-20 4:51 
GeneralRe: Performance woes. I'm appalled. Pin
Gerry Schmitz26-Dec-20 15:19
mveGerry Schmitz26-Dec-20 15:19 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch26-Dec-20 16:49
mvahoney the codewitch26-Dec-20 16:49 
GeneralRe: Performance woes. I'm appalled. Pin
k505427-Dec-20 3:34
mvek505427-Dec-20 3:34 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch27-Dec-20 3:56
mvahoney the codewitch27-Dec-20 3:56 
GeneralRe: Performance woes. I'm appalled. Pin
obermd28-Dec-20 3:45
obermd28-Dec-20 3:45 
GeneralRe: Performance woes. I'm appalled. Pin
honey the codewitch28-Dec-20 3:47
mvahoney the codewitch28-Dec-20 3:47 
GeneralFun with Java Pin
Cp-Coder25-Dec-20 13:09
Cp-Coder25-Dec-20 13:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.