aurelian
aurelian
MModular
Created by fuckAllTechCompanies on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
o m g
28 replies
MModular
Created by fuckAllTechCompanies on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
wait, ints are boxed??
28 replies
MModular
Created by fuckAllTechCompanies on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
now I see why the op was looking for a magic tool
28 replies
MModular
Created by fuckAllTechCompanies on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
python is a hellscape
28 replies
MModular
Created by fuckAllTechCompanies on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
for a list, isn't it just capacity * element size?
28 replies
MModular
Created by fuckAllTechCompanies on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
activity monitor gives you process memory info
28 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
more a mojo question
38 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
of the struct field
38 replies
MModular
Created by Martin Dudek on 10/18/2024 in #community-showcase
Mojo added to SpeedTests repo on github
though it seems to be a tiny improvement on my machine
16 replies
MModular
Created by Martin Dudek on 10/18/2024 in #community-showcase
Mojo added to SpeedTests repo on github
zig has no bounds checks in ReleaseFast
16 replies
MModular
Created by Martin Dudek on 10/18/2024 in #community-showcase
Mojo added to SpeedTests repo on github
I should have put inlinearray and unsafe_get in v2
16 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
this could just be a loop
38 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
looking forward to comptime reflection
38 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
could the return type be inferred here, down the road?
fn __init__(inout self, json: Object) raises:
frame = json["frame"].object()
self.x = abs(frame["x"].float()).cast[DType.int16]()
self.y = frame["y"].float().cast[DType.int16]()
self.w = frame["w"].float().cast[DType.int16]()
self.h = frame["h"].float().cast[DType.int16]()
self.x2 = self.x + self.w
self.y2 = self.y + self.h
fn __init__(inout self, json: Object) raises:
frame = json["frame"].object()
self.x = abs(frame["x"].float()).cast[DType.int16]()
self.y = frame["y"].float().cast[DType.int16]()
self.w = frame["w"].float().cast[DType.int16]()
self.h = frame["h"].float().cast[DType.int16]()
self.x2 = self.x + self.w
self.y2 = self.y + self.h
38 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
was easy to add from_list
38 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
@bgreni thanks for this, working well
38 replies
MModular
Created by aurelian on 10/19/2024 in #questions
why is this return a copy?
this video is great btw
39 replies
MModular
Created by aurelian on 10/19/2024 in #questions
why is this return a copy?
is there a written deep dive on lifetimes?
39 replies
MModular
Created by aurelian on 10/20/2024 in #questions
why does this String init work without len?
diocletiann. thanks!
52 replies
MModular
Created by Martin Dudek on 10/18/2024 in #community-showcase
Mojo added to SpeedTests repo on github
alias N: UInt32 = 440_000_000

fn is_munchausen(number: UInt32, cache: List[UInt32]) -> Bool:
n = number
var total: UInt32 = 0

while n > 0:
digit = n % 10
total += cache[int(digit)]
if total > number:
return False
n //= 10

return total == number

fn get_cache() -> List[UInt32]:
ca = List[UInt32](capacity=10)
ca.append(0)

@parameter
for i in range(1,10):
ca.append(i**i)
return ca

fn main():
cache = get_cache()
for n in range(0, N):
if is_munchausen(n, cache):
print(n)
alias N: UInt32 = 440_000_000

fn is_munchausen(number: UInt32, cache: List[UInt32]) -> Bool:
n = number
var total: UInt32 = 0

while n > 0:
digit = n % 10
total += cache[int(digit)]
if total > number:
return False
n //= 10

return total == number

fn get_cache() -> List[UInt32]:
ca = List[UInt32](capacity=10)
ca.append(0)

@parameter
for i in range(1,10):
ca.append(i**i)
return ca

fn main():
cache = get_cache()
for n in range(0, N):
if is_munchausen(n, cache):
print(n)
16 replies