Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Go

Name: Anonymous 2012-06-23 6:16

Currently running this bitch on a server with 24 processors clocked at 2.6Ghz, 16GB of ram and fiber connection. Currently pinging about 300-400 IP addresses/second. And the glue holding this bitch together is Go. Look at that simple concurrency model and message passing, it's a thing of fucking beauty. Now to get this running on the other 4 servers just like it.

http://pastebin.com/rqEvpszX
Currently running at: 177 valid IPs/second, 582 IPs/second

And I know that the last part is a little hacky and that the IP functions should be moved to their own source file. Bite me.

Why aren't you using Go /prog/?

Name: Anonymous 2012-06-23 17:32

>>37
You sure about that? I thought that the fields of a union had to occupy the same region of memory, which would be the size of the largest field (so a union { uint64_t u64; int32_t i32; }; would be 8 bytes).

Name: Anonymous 2012-06-23 17:36

>>41
As a sidenote: The size occupied by a symbol in memory is not necessarily the minimum size possible, for optimization issues.

Name: Anonymous 2012-06-23 17:38

>>37,41
I suppose that if the union was volatile it would be required to actually update the field, but there's still endianness, padding bits, and integer representations to worry about.

Name: Anonymous 2012-06-23 17:38

The standard doesn't say anything about the exact encoding of data. It is implementation-dependent.

Name: Anonymous 2012-06-23 17:42

>>43
volatile has nothing to do with this...

Name: Anonymous 2012-06-23 18:19

And this thread has officially devolved into a C pissing match.

Name: Anonymous 2012-06-23 18:21

>>37,41,43
It doesn't matter if it's volatile or not, they do overlap in size but after writing to one field it is undefined behavior to read from another.

Name: Anonymous 2012-06-23 18:28

>>46
This is hardly a pissing contest, it's just people who don't know the basics of C and some who do.

Name: Anonymous 2012-06-23 18:36

>>45
Yes it does. It ensures that the memory is actually written to.
union {
    char c;
    unsigned char u;
} u;
volatile union {
    char c;
    unsigned char u;
} vu;
u.c = 10; /* may be stored in a register or optimized away */
printf("%u", (unsigned)u.u); /* accessing u.u is undefined behavior */
vu.c = 10; /* must be written to memory */
printf("%u", (unsigned)vu.u); /* vu.u is guaranteed to contain 10 */

Name: Anonymous 2012-06-23 18:45

>>49
but that's just plain wrong... volatile ensures the memory is read, not written, because it warns the compiler that there might be code that is doesn't know about that also uses that memory address

in your example u.c = 10; can surely be optimized but only if the other symbol is not used like you do just after, decent compilers aren't that stupid yet, if u.c = 10; is optimized then u.u will use the same register

but go ahead test it, gcc -O3 that code and see for yourself

Name: Anonymous 2012-06-23 19:49

Hey, look at how many C caveats I have memorized! This is truly the language of the Gods!! Am I an EXPERT PROGRAMMER yet?

Name: Anonymous 2012-06-23 20:01

>>51
Not unless you can't actually use even one of them to construct an elegant algorithm.

Name: Anonymous 2012-06-23 20:36

>>39
IIRC type punning like that is undefined.

Name: Anonymous 2012-06-23 20:43

Use Perl, OP.
join '.', unpack 'C4', pack 'N', $ip++

Name: Anonymous 2012-06-23 22:23

Check em ninjas

Name: Anonymous 2012-06-24 5:34

>>49
It is still undefined behavior to write to the c field and then read from the u field. This is very clear in the standard and it's quite obvious as well considering how many different types of architectures there are out there.

Name: Anonymous 2012-06-24 6:21

>>56
Read the footnote for 6.5.2.3 point 3, C99 TC3 or C11.

Name: Anonymous 2012-06-24 8:36

Fewer modules and smaller community than the common languages. I don't need the niche it fills of easy to use multicore/network code.

My work falls into three categories:
system scripting:
{z,ba}sh

system/performance critical:
C

eeeeeeeeverything else:
Python

No room for Go anywhere.

Name: One Happy Nigga 2012-06-24 8:41

Go has some pretty serious show-stopping bugs:

https://groups.google.com/group/golang-nuts/browse_thread/thread/ab1971bb9459025d

I use Python for everyday programming and web development, C where I must (commercial compiled stuff) with Lua for embedded scripting capabilities, Bash for simple shell scripting, and newLISP for exploratory programming.

Name: Anonymous 2012-06-24 10:18

>>57
Do you even know what a trap representation is? Honest to god I can't believe how unbelievably slow some people on /prog/ are, that very footnote specifically states that the value is unspecified and therefore the program contains undefined behavior.

Name: Anonymous 2012-06-24 10:20

>>60
s/unspecified/indeterminate/

Name: Anonymous 2012-06-24 11:35

>>60
unsigned char has no trap representations that produce undefined behaviour.

Name: Anonymous 2012-06-24 12:07

>>62
When a value is stored in a member of an object of union type, the bytes of the object representation that do not correspond to that member but do correspond to other members take unspecified values.

Name: Anonymous 2012-06-24 12:23

>>30-53,56-57,60-62
Hey! We're supposed to be talking about a shit language, not C!
Let me get you guys back on track:
- Go has a shit GC that's worse than Boehm GC.
- Go only runs on x86, ARM and x86-64.
- Go has semicolon insertion.
- Go has forced K&R bracing of code.
- Go has an ugly declaration syntax.
- Go proponents think constant crashes aren't a bug.
- The Go compiler creates a 1 MB Hello World.

Name: Anonymous 2012-06-24 12:26

>>64
- Go has a shit GC that's worse than Boehm GC.
Is that... possible?

Name: Anonymous 2012-06-24 12:29

>>64
B-but I like K&R style, baka

Name: Anonymous 2012-06-24 12:33

>>64,65
I thought it used the Boehm GC, they just tune it poorly.

Name: Anonymous 2012-06-24 12:36

To use Go efficiently you must,

- avoid struct types which contain both integer and pointer fields

- avoid struct types containing arrays such as [100]byte (replace it with *[100]byte or with []byte)

- avoid data structures which form densely interconnected graphs at run-time

- avoid deep call chains at run-time

- replace pointer identity with value equivalence (this can lead to a more explicit memory management in your program)

- if a data structure contains both long-lived and short-lived fields, move the short-lived fields into a separate data structure or into local variables of a function

- avoid integer values which may alias at run-time to an address; make sure most integer values are fairly low (such as: below 10000)

- if you are using caches to speed up your program, apply the rules mentioned here to redesign the cache. It may also help to use strings instead of structs as map keys.

- lower the overall memory consumption of your program

- carefully speed up your program (this may lead to a lower memory consumption in certain situations)

- call runtime.GC()  (at the right moment)

Name: Anonymous 2012-06-24 12:43

eventually everyone will realize lisp is the way.

Name: Anonymous 2012-06-24 13:07

lisp is shit

Name: Anonymous 2012-06-24 13:29

>>70
no, no, lisp is shit, parenthesized. if only the SUSS had finished his fucking job and done the surface syntax too :(

Name: Anonymous 2012-06-24 13:37

>>68
You will never need a number bigger than 10. Discuss.

Name: Anonymous 2012-06-24 15:39

i want a pal

Name: Anonymous 2012-06-24 16:58

>>72
int one_decimal_digit_per_int[]

Name: Anonymous 2012-06-24 19:24

main = sequence_ $ parMap rseq createProcess
       [proc "ping" . (["-c", "2", "-i", "0.2", "-w", "1"] ++) . (:[]) . intercalate "." . map show $
        [a,b,c,d] | a <- [0..255], b <- [0..255], c <- [0..255], d <- [0..255]]

Name: Anonymous 2012-06-24 19:41

>>75
better:
main = sequence_ $ parMap rseq
  (createProcess . proc "ping" .
   (["-c", "2", "-i", "0.2", "-w", "1"] ++) .
   (: []) . intercalate "." . map show) .
  sequence $ replicate 4 [0..255]

Name: Anonymous 2012-06-24 19:42

lol Go sucks

Name: Anonymous 2012-06-25 12:08

蝉ᄈ聉际戒㎙啄䆓䝓ᦒᥤܦ㤆噦㘈杦㉠✖儐艀硲㜃衄䥄ℑ㍓鐡舗萓虖╰Ⅳ㘄蠣咃ℰ附咈Ѣ᎖蝲▗〰捇靲肐遷馅肙喗頲鈒偸͘㍳⍓塗愕ᜑ荳䒅⤱䐷ᡩ青㞙∆⦑硹撈ᥖ䅹⠉褠█蜦♠恃鈀᜴ݱध畄晡ᔠ青偒砳儲を㡹瑖㢗錃舳䄉腡鐄ㄇ酆商⁖鍵⑃硲ᔙ䀥愕圇ȩ㎁䞁ؤすƁ堹Ł䤧蘂ݳ㙆怴蝃搁⑇މ┖砑夃ȕ䄹ᕐʖᥡ顰Ո㐡挱ࢀ䦃整璖陥ᘆ顁嚓㢘圤፥㌸焗᎘᠐朵∃皁暖鉸煈坱垖㞗畈喖ঐ楖䂁敡㕀挗㤥芕扲偄䉧儨噧葲刢䄡蜳ጙ䍸鄱㠑䚄憆䀰ᄂ慙袓逅ܸ؂玓兢炓睐㐸父蔦္逩Ԇ硷蕈瘃ㄑ鎕᎙耶Ƃ刉耒ᙀ͙⡸焓噢怙∧⤡䁴襕р蝤㝧ㅘ塓⑷畢㝥攁閑倖摁ቐጴ䀨熈ᤒ攔邃逨⑅䘅♂餳㑕瑉頔Ƅ᠑⡹褢ո疗ޓ䅈ᒉ䔧䔁╄ɠ䞑遱锩晃㝃週疀̓㐵ᙘᢖ㈘荸儉锸睨卵ဉ聤≖㞓✘瀖〖㑀獁芖ᕐ刕蠥ᜃ㊒昑ᡩ✃

Name: Anonymous 2012-06-25 12:24

刦呵₇荤饄炓ᆖᢔ䈴†⡷獠际夂぀㕑薙匰㚗ᑀ蒈⎁猁嘶࠹栖摁⑸䆕㠩醕⍩✱㡳ぅ逃އ㚈顤㉳ㅗ梃Ƈ礢䀕ጄ᝔攄䁹蕱肁茵楣㊓遵♳畐瞇㘑⑒聳⢖餈鄙葂ᄦ傗冉瞐ॅ␓褁鈆儓焩❶ᒀᆇ䕢ࡢጥ͔袅嘇戅㌴餹㥥兓愶̐甹၆䤖䐴醈घ甒㌈夷圢儸䄁玀䘉恔䒙⑖怒ᐳ❧睉䥵钘䎓ᆑ鎖邔晴膙╅☹疕挗睒䞁䌒⊂ᑰʖ劃‚㥤唉ᐃ⚅䒔ሔ̔睰剰鄧㡙⒉奆熅㤂途楹ᅵ露䍘聳r䘸奇厓枈鈐閑蕡灇䡃荷抐偒蜶灒㉗锁ኁ̡ᆗ砠堤ᐕ畩ᔵ天皙色䌐॓塣㜃ࠅ䍣禒䊉ᖖ塐鄨錦瘹琶遨堸䚁梑蔙቙嚙顸脁㜶隒䅄蕠邅ᎈॶ蘆灔ᑳᤨ院葀ᡩ♓㖑礢邈̒Ւ̡偡瑀┱䞀ᜢͣŤ噡啹䥓袙ᔐ㆒䌀蕴㐐ቄ䁨ƙ䖂ࠨ䠳㥈霠蕩斃Ђ܅耲怑愅蒆琗ᥙ杁䐹䆒⊃ᕠ褅啱㡳⍅鍣虸摵͹昩͓硒捙ᡀ⥓㔈薓阆㔑䚖椠✁䎇鄡㠳悑薕銔ᐥႂ ᖀ閙隑䜡ᥧ㘣

Name: Anonymous 2012-06-25 12:53

犃ɵ圉℄ኁ瑤ᅳᥓ馁攥ݗ树夣怕䜢ᑔ䅲ؘ捳ᡥ✠⤔虵ℶ㘗͑儹瑤咕䌥错䠦爕☳荳硰䑰ࡇ祇刢眔ᄖ㝅荀ɷ陱ኇ∦ᤁ㌑桨頵杠剶昕鞀玀扗镡匴┸増ᘖᐦ昖呈☷鈸‘〸遹嘓瘁礑扙≶ᝑ鑆碕ݲ✦㥷皀ㄴՠ搖栈愵㊄牀䁈褐顗茒␦䔢ᜱ≰ፓ霄恂Ըᢉᐉ霠䡣祠6ኅ➄ᦗኅ荄芖儥㜡閁䡸䞓梔զ蒘餕癐♈⦐堧硗䙸奷逘镓焷㈢䥵奇☀ふᜅሧ陃㝀恄㤱茴呴⢅ቄሸ熓䔹㦃⌱甑Ԗ捗᥵⢃⤓包猉䔱吥唷猦⑵㠩饙禓䑙圹莆ፀ鄉憓愥锷瘶ᆓ䊇褡c晡瀘鑅镨授㔸閅ㆉ熁蘠慄ࢀ䎖钅蒙鐙㕑⒐礧憄⢙桕)挒╖ဒ舰獣س吩ᆓ✹ر栄㡐Ѐ㔙ᦗ㉆␵萓⍢䌒襄Ж㌃逖በ摙夵≈㔀芅䦑劆㑕噂畘砅⦖┐ၱᘣ卵〱霄㒉搤̄㕀撒ބ䌸∸⍑楃桤餖䌥⌳鄨癶ሔ░襇嘣兘戕ă䥲ሤ儕卶蔆蜔的爉恸蚒㙒䔰印ᑵ時㕧螈脡卸㖙䅓睳蚃達䔸䐃も當

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List