DEV Community

Discussion on: Daily Coding Puzzles - Nov 4th - Nov 9th

Collapse
 
ben profile image
Ben Halpern

Ruby

a - b
Collapse
 
gartboy profile image
Garrett

Similar effort when done in APL! :)

Collapse
 
aspittel profile image
Ali Spittel

That's amazing!

Thread Thread
 
ben profile image
Ben Halpern

Thread Thread
 
ben profile image
Ben Halpern

On the other hand, Ruby probably allocated about 10,000 object references under the hood and used 1gb of memory to make that happen. 😄

Thread Thread
 
thejessleigh profile image
jess unrein • Edited

Honestly, I just came out here to have a good time and I'm feeling so attacked right now 😅😅😅

Thread Thread
 
ben profile image
Ben Halpern
Thread Thread
 
thejessleigh profile image
jess unrein

Haha nice. Honestly, I'm just so used to copy/pasting emojis from slack and discord. Fun fact, when you do that, it copies the colon emoji syntax, not the unicode glyph 😅🙃

Thread Thread
 
ricardobeat profile image
Ricardo Tomasi

@bendhalpern some numbers (using /usr/bin/time -l on OSX):

Go: 0.0s, 1.5Mb
Go run: 0.10s, 24Mb
Node: 0.06s, 19Mb
Ruby: 0.08s, 11Mb
Crystal: 0.0s, 1.5Mb
Crystal run: 0.4s, 10.4Mb
Thread Thread
 
rakenodiax profile image
rakenodiax
Rust: 0.00s - 1.12MiB
Rust (nightly): 0.01s - 0.88MiB
Go: 0.00s - 1.64MiB
Go run: 0.25s - 24.11MiB
Python: 0.21s - 5.48MiB

Disclaimer: I'm inexperienced with Go; using the example from below 😅

Thread Thread
 
thejessleigh profile image
jess unrein

Oh, I know almost nothing about Go. I'm specifically using these exercises to learn the syntax. No clue if and how what I'm doing can be optimized. Go is famously, weirdly restrictive and intentionally verbose.

Collapse
 
anologicon profile image
Anologicon

kkkkk it's very simple dude :D

Collapse
 
dance2die profile image
Sung M. Kim

Ah, cannot unsee this answer... 😆

Collapse
 
elizarov profile image
Roman Elizarov

Same in Kotlin :)