• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:11
CEST 21:11
KST 04:11
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
ByuL, and the Limitations of Standard Play1Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12TL.net Map Contest #22 - Voting & Ladder Map Selection7Code S Season 2 (2026) - RO8 Preview8
Community News
[TLMC] Summer 2026 Ladder Map Rotation05.0.16 patch for SC2 goes live (8 worker start)63ZeroSpace at Steam NextFest - Last free demo31Weekly Cups (June 8-14): Clem and Solar double, PTR tested0RSL: S6 Finals played at BlizzCon 202611
StarCraft 2
General
Mizenhauer's Douyu Cup Preview ByuL, and the Limitations of Standard Play Is the larve respawn broken? 5.0.16 patch for SC2 goes live (8 worker start) Possible bug in the new patch?
Tourneys
RSL Revival: Season 6 - Qualifiers and Main Event Douyu Cup 2026: $20,000 Legends Event (June 26-28) INu's Battles#17 <BO.9> Sparkling Tuna Cup - Weekly Open Tournament GSL CK #4 20-21th June
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 531 Experimental Artillery Mutation # 530 One For All Mutation # 529 Opportunities Unleashed
Brood War
General
ASL 22 Proposed Map Pool BW General Discussion Quality of life changes in BW that you will like ? [BSL22] Non-Korean Championship from 13 to 28 June BSL Season 22
Tourneys
[Megathread] Daily Proleagues The Casual Games of the Week Thread [BSL22] GosuLeague Casts - Tue & Thu 22:00 CEST CSLAN 4 is Coming!
Strategy
Creating a full chart of Zerg builds Relatively freeroll strategies Why doesn't anyone use restoration? Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Beyond All Reason Nintendo Switch Thread ZeroSpace at Steam NextFest - Last free demo
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
Vanilla Mini Mafia
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread [H]Internet/Gaming Cafe Tips and Tricks
Fan Clubs
The HerO Fan Club! The herO Fan Club!
Media & Entertainment
Movie Discussion! Series you have seen recently... [Req][Books] Good Fantasy/SciFi books [TV/BOOK] *SPOILERS* Game of Thrones Discussion
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 McBoner: A hockey love story Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
Listen To The Coaches!
TrAiDoS
An Exploration of th…
waywardstrategy
I'm an arrogant trash talke…
FlaShFTW
Gauntlet SC2: A Retrospectiv…
Ctone23
Customize Sidebar...

Website Feedback

Closed Threads



Active: 7293 users

The Big Programming Thread - Page 991

Forum Index > General Forum
Post a Reply
Prev 1 989 990 991 992 993 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2019-01-22 10:36:10
January 22 2019 10:35 GMT
#19801
On January 22 2019 04:38 SC-Shield wrote:
Show nested quote +
On January 22 2019 01:15 Mr. Wiggles wrote:
On January 20 2019 22:54 SC-Shield wrote:
Do you guys know a good article to read about POSIX concurrency (threads and synchronisation) as well as signals? If not, I'll just stick to what I've found on Google so far.

Not an article, but the book "Advanced Programming in the UNIX Environment" by W. Richard Stevens has a very good treatment of many UNIX systems programming concepts. There's an entire chapter on each of the subjects of signals, threads, and thread control.

I believe there's source for the book available so you can theoretically make your own PDF if you don't want to buy it.

http://www.apuebook.com/apue3e.html


... HR warned me before that he had weird sense of humour ...


omg so many red flags


I'm so glad I work at a company with ... nice people. Don't settle for companies like that.
There is no one like you in the universe.
Excludos
Profile Blog Joined April 2010
Norway8263 Posts
January 22 2019 11:10 GMT
#19802
Honestly recursion is a fucking mess. I get that it looks cool, and in certain mathematical function it definitively makes sense, but it's a mess to look at, and a nightmare for any second hand person coming in to maintain your code later. I avoid them like the plague
SC-Shield
Profile Joined December 2018
Bulgaria862 Posts
Last Edited: 2019-01-22 11:23:36
January 22 2019 11:22 GMT
#19803
On January 22 2019 01:15 Mr. Wiggles wrote:
Show nested quote +
On January 20 2019 22:54 SC-Shield wrote:
Do you guys know a good article to read about POSIX concurrency (threads and synchronisation) as well as signals? If not, I'll just stick to what I've found on Google so far.

Not an article, but the book "Advanced Programming in the UNIX Environment" by W. Richard Stevens has a very good treatment of many UNIX systems programming concepts. There's an entire chapter on each of the subjects of signals, threads, and thread control.

I believe there's source for the book available so you can theoretically make your own PDF if you don't want to buy it.

http://www.apuebook.com/apue3e.html


I was reading about reader-writer locks and realised that C++17 introduces shared_mutex which is quite nice to have something more portable than POSIX. Based on my understanding, this is how it works in C++.

Readers and writers have access to the same mutex which is shared_mutex.
If a thread is a reader, it's expected to use shared_lock. Obviously, data isn't supposed to be modified then. If a thread is a writer, then it's expected to use unique_lock (not shared_lock).

Example: https://en.cppreference.com/w/cpp/thread/shared_mutex
Manit0u
Profile Blog Joined August 2004
Poland17774 Posts
Last Edited: 2019-01-22 11:27:08
January 22 2019 11:25 GMT
#19804
On January 22 2019 19:35 Blisse wrote:
Show nested quote +
On January 22 2019 04:38 SC-Shield wrote:
On January 22 2019 01:15 Mr. Wiggles wrote:
On January 20 2019 22:54 SC-Shield wrote:
Do you guys know a good article to read about POSIX concurrency (threads and synchronisation) as well as signals? If not, I'll just stick to what I've found on Google so far.

Not an article, but the book "Advanced Programming in the UNIX Environment" by W. Richard Stevens has a very good treatment of many UNIX systems programming concepts. There's an entire chapter on each of the subjects of signals, threads, and thread control.

I believe there's source for the book available so you can theoretically make your own PDF if you don't want to buy it.

http://www.apuebook.com/apue3e.html


... HR warned me before that he had weird sense of humour ...


omg so many red flags


I'm so glad I work at a company with ... nice people. Don't settle for companies like that.


Nice HR department though. I wish someone warned me beforehand that most of my coworkers will be ultra-catholic and such. Not that big of a deal but it is a bit disturbing since I've always viewed programmers as less religious (and now I must hold back on some jokes and comments while in the office lest I get into another pointless debate on "How do you know right from wrong without God?!").
Time is precious. Waste it wisely.
Acrofales
Profile Joined August 2010
Spain18326 Posts
January 22 2019 12:33 GMT
#19805
"I read the same book you did, I just don't think it was the word of God"
Excludos
Profile Blog Joined April 2010
Norway8263 Posts
Last Edited: 2019-01-22 15:46:29
January 22 2019 15:46 GMT
#19806
On January 22 2019 21:33 Acrofales wrote:
"I read the same book you did, I just don't think it was the word of God"


Hitchikers guide to the galaxy? Pretty sure those be the words of god..well, a god
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 23 2019 02:08 GMT
#19807
On January 22 2019 18:21 Manit0u wrote:
Show nested quote +
On January 21 2019 06:01 WarSame wrote:
On January 20 2019 08:17 tofucake wrote:
Break and continue are amazing, especially in batching. People who say to never use them and to just design stuff "better" are wrong.

How so? Where would you reasonably use them that using sub functions wouldn't work so well and be much clearer?


It is easy to substitute simple looping with recursion. But then you can potentially run into a couple of problems:
- if your language doesn't support TCO you will run into performance issues
- if your language does support TCO you can't debug it properly since you lose the stack trace

Recursion will also be a real mess for cases like that:


outer loop
outer a

inner loop
inner a

if condition
continue outer (without going to outer b)

inner b

outer b


Edit: This too depends on a language of choice of course. Some make looping easier for you.

I'm wondering, though, couldn't you redesign this code?


outer_loop:
outer_loop_logic()

outer_loop_logic():
outer_a()
val = inner_loop()
if (val == null) outer_b()

inner_loop():
val = null
inner_a()
if (condition):
val = something
inner_b()


This way you have each function only doing one thing and you have no unexpected jumps within your code(your only jumps being function calls, returns and regular control logic). I'm thinking this in particular because at work I have to deal with continues nested inside a 150 line loop which is in a loop which is in a loop... which loop is getting continued? Who knows?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
tofucake
Profile Blog Joined October 2009
Hyrule19224 Posts
January 23 2019 04:13 GMT
#19808
You should? continue (in languages that support levels of it) defaults to 1 (current loop) and ascends from there. In languages without levels, continue affects the loop it is immediately inside of.

All you've done with that code is rewrite some while loops into do loops but hiding the fact by using function calls.
Liquipediaasante sana squash banana
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 23 2019 04:15 GMT
#19809
But hasn't that made it easier to read and reason about?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
tofucake
Profile Blog Joined October 2009
Hyrule19224 Posts
January 23 2019 04:54 GMT
#19810
No, it's made everything disjointed. It looks fine in pseudo code but in actual practice things are a lot more complicated
Liquipediaasante sana squash banana
Manit0u
Profile Blog Joined August 2004
Poland17774 Posts
Last Edited: 2019-01-23 09:30:25
January 23 2019 09:13 GMT
#19811
On January 23 2019 13:15 WarSame wrote:
But hasn't that made it easier to read and reason about?


You've also made a mistake there. In your inner loop when condition is met you must now return some magic value (and not proceed to inner b) to make outer loop logic aware that it should skip over to the next iteration (and null isn't really good for that since it's default return value for functions most of the time).

So, using recursion this code would look more like that:


rec_outer(args)
if end_condition
return

outer a

result = rec_inner(args)

if result == magic
return rec_outer(args)

outer b

return rec_outer(args)

rec_inner(args)
if end_condition
return

inner a

if condition
return magic

inner b

return rec_inner(args)


Now tell me which is more readable to you... Especially that in recursion you now need to pass extra args around everywhere to control it whereas in loops it's all abstracted away.
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
January 23 2019 17:09 GMT
#19812
Realistically there are cases where continues/breaks are better, and there are cases where you can restructure the code and make it better that way. Ideally you just try both options and choose the one best suited for your particular case.

In practice, you randomly choose one and maybe clean it up a little.

Also don't forget that there sometimes is an option to refactor that kind of nested loop in a completely different way (rather than just wrapping loops into functions). For example you could attempt to first create a (lazily evaluated) sequence of tuples (a, b), then filter those tuples, then work with the rest. Not always the best choice, but sometimes just so much better.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17774 Posts
January 24 2019 01:23 GMT
#19813
In practice whatever works best in current situation is usually what ends up being used. No matter how "ugly" it might be to the purists.
Time is precious. Waste it wisely.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 24 2019 02:17 GMT
#19814
Okay, I accept that! So this hasn't entirely changed my view but I can definitely agree that both are valid in their own use cases. Thanks for the discussion!
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Manit0u
Profile Blog Joined August 2004
Poland17774 Posts
Last Edited: 2019-01-24 10:03:20
January 24 2019 09:32 GMT
#19815
https://www.theregister.co.uk/2019/01/22/google_chrome_browser_ad_content_block_change/

Edit:

Heh, I got myself into a nice mess... Got a task of investigating some users missing rewards for the ads they've watched. We have over 4.5 billion users in our db and there have been 2.7 billion reward attempts this month.

Time to put my SQL goggles on.
Time is precious. Waste it wisely.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
January 24 2019 16:24 GMT
#19816
On January 24 2019 18:32 Manit0u wrote:
https://www.theregister.co.uk/2019/01/22/google_chrome_browser_ad_content_block_change/

Edit:

Heh, I got myself into a nice mess... Got a task of investigating some users missing rewards for the ads they've watched. We have over 4.5 billion users in our db and there have been 2.7 billion reward attempts this month.

Time to put my SQL goggles on.

Temp tables with indexes!
Manit0u
Profile Blog Joined August 2004
Poland17774 Posts
January 24 2019 23:20 GMT
#19817
On January 25 2019 01:24 enigmaticcam wrote:
Show nested quote +
On January 24 2019 18:32 Manit0u wrote:
https://www.theregister.co.uk/2019/01/22/google_chrome_browser_ad_content_block_change/

Edit:

Heh, I got myself into a nice mess... Got a task of investigating some users missing rewards for the ads they've watched. We have over 4.5 billion users in our db and there have been 2.7 billion reward attempts this month.

Time to put my SQL goggles on.

Temp tables with indexes!


I work for a company that has the biggest mysql db in europe and due to traffic and response times requirements they got rid of stuff like indices and shit (with large enough tables indices slow you down).

I'm in the 20-30 minute wait to discover this was not the query you were looking for territory...
Time is precious. Waste it wisely.
JimmyJRaynor
Profile Blog Joined April 2010
Canada17642 Posts
Last Edited: 2019-01-25 02:27:34
January 25 2019 01:17 GMT
#19818
What exactly slows down due to the presence of indexes? a search for a single record? a certain type of query?
Normally, adding new records gets slower as one generates more indexes for a table.

what size of table starts to see these "slow down" issues?

i'm a microsoft guy. i know very little about mysql.
Ray Kassar To David Crane : "you're no more important to Atari than the factory workers assembling the cartridges"
Lmui
Profile Joined November 2010
Canada6223 Posts
Last Edited: 2019-01-25 08:13:54
January 25 2019 08:08 GMT
#19819
On January 25 2019 10:17 JimmyJRaynor wrote:
What exactly slows down due to the presence of indexes? a search for a single record? a certain type of query?
Normally, adding new records gets slower as one generates more indexes for a table.

what size of table starts to see these "slow down" issues?

i'm a microsoft guy. i know very little about mysql.


Just points that apply generally for every database

Updates/Inserts are slower with more indexes since they're traditionally duplicates of data in existing tables.
Anything requiring a lock for read/update on anything other than the full table also slows dramatically as you add indexes since the indexed rows need to be locked as well.

Reads on non-* queries are generally faster if they're using fewer columns than are in the full table.

Before you hit 100s of gb, you should've already optimized the shit out of the structure of the database, and determined the architecture of your DB for 5+ years. Hard to say when the query starts slowing down since it's a fairly steady increase in query time with db size.

As much as I hate to say it, you get what you pay for. Using full blown Oracle (Literally costs 10+ million a year at this scale) instead of mysql, or any of the other databases which are proven to scale to petabytes (SQL Server, SAP HANA etc.) is what this use case helps a lot with. Odds are if you did, the query would probably still be in the 10s of seconds to low minutes range. This is especially true if you are using database instances that fit within memory of a few giant servers (low 10s of TB).
Acrofales
Profile Joined August 2010
Spain18326 Posts
January 25 2019 14:31 GMT
#19820
On January 25 2019 08:20 Manit0u wrote:
Show nested quote +
On January 25 2019 01:24 enigmaticcam wrote:
On January 24 2019 18:32 Manit0u wrote:
https://www.theregister.co.uk/2019/01/22/google_chrome_browser_ad_content_block_change/

Edit:

Heh, I got myself into a nice mess... Got a task of investigating some users missing rewards for the ads they've watched. We have over 4.5 billion users in our db and there have been 2.7 billion reward attempts this month.

Time to put my SQL goggles on.

Temp tables with indexes!


I work for a company that has the biggest mysql db in europe and due to traffic and response times requirements they got rid of stuff like indices and shit (with large enough tables indices slow you down).

I'm in the 20-30 minute wait to discover this was not the query you were looking for territory...

Why don't you take a slice, figure out the query you want on the slice, and then once you got it mostly debugged, execute it on the full DB? There'll probably still be some bugs due to weird corner cases that weren't in your slice, but at least you won't have to wait 20-30 minutes *every* time you want to test a query.
Prev 1 989 990 991 992 993 1032 Next
Please log in or register to reply.
Live Events Refresh
OSC
16:00
King of the Hill #254
EmpressLilyy54
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ByuN 749
LamboSC2 542
BRAT_OK 58
MindelVK 26
mouzStarbuck 23
ForJumy 11
StarCraft: Brood War
Britney 16323
Calm 2692
Mini 689
EffOrt 465
Jaedong 452
Shuttle 319
BeSt 160
ggaemo 148
Dewaltoss 118
firebathero 85
[ Show more ]
Sea.KH 49
actioN 44
scan(afreeca) 36
Rock 15
HiyA 13
Purpose 6
Counter-Strike
ScreaM4187
fl0m2570
byalli1103
Other Games
FrodaN1111
Beastyqt781
ceh9628
ArmadaUGS136
QueenE56
Mew2King54
Trikslyr50
Organizations
StarCraft 2
TaKeTV 478
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 17 non-featured ]
StarCraft 2
• StrangeGG 94
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• Azhi_Dahaki27
• FirePhoenix9
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Nemesis4389
• TFBlade1121
Other Games
• imaqtpie773
• Shiphtur273
Upcoming Events
Bombastic Starleague
49m
Douyu Cup 2020
9h 49m
Neeb vs Impact
MacSed vs Cyan
Scarlett vs Kelazhur
INnoVation vs Dear
Big Brain Bouts
20h 49m
Jumy vs eGGz
Harstem vs sebesdes
TriGGeR vs HeRoMaRinE
Douyu Cup 2020
1d 9h
Maestros of the Game
1d 17h
herO vs Classic
Maru vs Serral
BSL22 NKC (BSL vs China)
1d 18h
Douyu Cup 2020
2 days
BSL22 NKC (BSL vs China)
2 days
Online Event
2 days
RSL Revival
3 days
[ Show More ]
WardiTV Weekly
3 days
RSL Revival
4 days
RSL Revival
4 days
Bombastic Starleague
5 days
Kung Fu Cup
5 days
OSC
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

Proleague 2026-06-24
WardiTV Spring 2026
Heroes Pulsing #2

Ongoing

IPSL Spring 2026
Acropolis #4
CSCL: Masked Kings S4
YSL S3
BSL 22 Non-Korean Championship
CSL Season 21: Qualifier 1
CSL Season 21: Qualifier 2
SCTL 2026 Spring
Douyu Cup 2026
Maestros of the Game 2
Murky Cup 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026

Upcoming

CSL 2026 Summer (S21)
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
BCC 2026
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E1
Heroes Pulsing #3
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.