Click here to Skip to main content
15,879,326 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.

 
GeneralRe: The best title for a QA? Pin
CPallini28-Dec-20 22:30
mveCPallini28-Dec-20 22:30 
GeneralRe: The best title for a QA? Pin
CodeWraith28-Dec-20 22:36
CodeWraith28-Dec-20 22:36 
GeneralRe: The best title for a QA? Pin
CPallini28-Dec-20 23:10
mveCPallini28-Dec-20 23:10 
GeneralRe: The best title for a QA? Pin
OriginalGriff28-Dec-20 22:46
mveOriginalGriff28-Dec-20 22:46 
GeneralI've really painted myself into a corner Pin
honey the codewitch28-Dec-20 15:00
mvahoney the codewitch28-Dec-20 15:00 
GeneralRe: I've really painted myself into a corner Pin
Ron Anders28-Dec-20 15:28
Ron Anders28-Dec-20 15:28 
GeneralRe: I've really painted myself into a corner Pin
Super Lloyd28-Dec-20 18:10
Super Lloyd28-Dec-20 18:10 
GeneralRe: I've really painted myself into a corner Pin
honey the codewitch28-Dec-20 18:23
mvahoney the codewitch28-Dec-20 18:23 
Edit: I figured it out. duh. and it's really too bad because only counting { and } is much faster.

Hey, you're a thinker. Riddle me this:

I want to scan JSON documents quickly, so I have a special function that works like string.IndexOfAny() does in .NET except at gigabyte/s speeds on modern machines.

I am looking for the end of the current object.

I stop at [ or { and increment a depth count.

I stop at ] or } and decrement a depth count.

Once depth hits zero I break.

Depth starts at zero so if there's no [ or { it will break at the next }

Why do I have to stop at [ and ] and count depths? Why can't I just count { and } since it's twice as fast?

For example

JavaScript
{
  "foo": "bar",
  "baz": [ { "a": 1 } ]
}


if i start in the inner most object i want to stop at the nearest end curly brace. If i start in the outermost object i want to stop at the final curly brace.

If I stop and count [ ] and it works. If I only count { } it doesn't. Why?

Real programmers use butterflies


modified 29-Dec-20 0:37am.

JokeRe: I've really painted myself into a corner Pin
W Balboos, GHB29-Dec-20 1:04
W Balboos, GHB29-Dec-20 1:04 
GeneralRe: I've really painted myself into a corner Pin
Sander Rossel29-Dec-20 3:17
professionalSander Rossel29-Dec-20 3:17 
GeneralRe: I've really painted myself into a corner Pin
honey the codewitch29-Dec-20 5:01
mvahoney the codewitch29-Dec-20 5:01 
GeneralWhen "Pro" meets Nerd Pin
Gerry Schmitz28-Dec-20 7:08
mveGerry Schmitz28-Dec-20 7:08 
GeneralRe: When "Pro" meets Nerd Pin
honey the codewitch28-Dec-20 7:18
mvahoney the codewitch28-Dec-20 7:18 
GeneralRe: When "Pro" meets Nerd Pin
Gerry Schmitz28-Dec-20 17:31
mveGerry Schmitz28-Dec-20 17:31 
GeneralRe: When "Pro" meets Nerd Pin
#realJSOP28-Dec-20 10:19
mve#realJSOP28-Dec-20 10:19 
GeneralRe: When "Pro" meets Nerd Pin
Jörgen Andersson28-Dec-20 10:44
professionalJörgen Andersson28-Dec-20 10:44 
GeneralRe: When "Pro" meets Nerd Pin
Gerry Schmitz28-Dec-20 17:01
mveGerry Schmitz28-Dec-20 17:01 
GeneralRe: When "Pro" meets Nerd Pin
Daniel Pfeffer28-Dec-20 20:50
professionalDaniel Pfeffer28-Dec-20 20:50 
GeneralBrits, UK'ians Pin
W Balboos, GHB28-Dec-20 6:55
W Balboos, GHB28-Dec-20 6:55 
GeneralRe: Brits, UK'ians Pin
OriginalGriff28-Dec-20 7:35
mveOriginalGriff28-Dec-20 7:35 
GeneralRe: Brits, UK'ians Pin
W Balboos, GHB28-Dec-20 7:38
W Balboos, GHB28-Dec-20 7:38 
GeneralRe: Brits, UK'ians Pin
OriginalGriff28-Dec-20 7:42
mveOriginalGriff28-Dec-20 7:42 
GeneralRe: Brits, UK'ians Pin
Daniel Pfeffer28-Dec-20 8:23
professionalDaniel Pfeffer28-Dec-20 8:23 
GeneralRe: Brits, UK'ians Pin
W Balboos, GHB28-Dec-20 8:26
W Balboos, GHB28-Dec-20 8:26 
GeneralRe: Brits, UK'ians Pin
Daniel Pfeffer28-Dec-20 8:55
professionalDaniel Pfeffer28-Dec-20 8:55 

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.