whatever
whatever
MModular
Created by xentropy on 8/27/2024 in #questions
mojo-lsp-server crashing
Hi, I experiment also on a m1 Mac with the newest official (not nightly) reales and get the crashing notice when using the vsc pluging for mojo. My script is still running normally just noticed the memory consumption of the lsp is sometimes 20mb sometimes over 100mb and was wondering why. Is this related to the crashing?
36 replies
MModular
Created by whatever on 12/26/2024 in #questions
List memory preallocation
Thanks
5 replies
MModular
Created by whatever on 11/20/2024 in #questions
How are Integers implemented in Mojo?
I find out that python only stores a single int object and has references on this in the list, if you use it several time.
a = [100000000 for _ in range(100)]
print(all(a[0] is x for x in a))
a = [100000000 for _ in range(100)]
print(all(a[0] is x for x in a))
` But I dont found a sorce explaining it yet
12 replies
MModular
Created by whatever on 11/20/2024 in #questions
How are Integers implemented in Mojo?
Can you send me a link to the mojo list implementation? I read that python uses interning, if the same value is used. So it only creates it once and than uses references to that. However I did not find a good explanation yet. Most say for integers its just in the range of -5 till 256, but this is not true. I meassure the same memory consumption regardless of using 1 as integer value or 1000000. Seems like Cpython uses interning also for higher integer values
12 replies
MModular
Created by whatever on 11/20/2024 in #questions
How are Integers implemented in Mojo?
If I modify it and append i (from 0 to 99 999 999) to the list, instead of each time 1. Mojo still uses 1.8gb, but python 3.12 uses 3,2gb
12 replies
MModular
Created by whatever on 11/20/2024 in #questions
How are Integers implemented in Mojo?
Thanks for your reply. Maybe Oftopic here: Why experimenting with python and mojo integer lists i noticed that, the memory consumption I measure with top is not the same each run in Python.
from time import sleep

def test_large_list(size):
# Create a large list
large_list = [1 for _ in range(size)]
sleep(10)
return large_list

if __name__ == '__main__':
# Measure memory usage
size = 100_000_000
list = test_large_list(size)
print(list[10])
from time import sleep

def test_large_list(size):
# Create a large list
large_list = [1 for _ in range(size)]
sleep(10)
return large_list

if __name__ == '__main__':
# Measure memory usage
size = 100_000_000
list = test_large_list(size)
print(list[10])
` If I run it top shows me memory consumptions between 150 and 800 mb. The consumption of this mojo process is always arround 1800mb
from time import sleep

fn test_large_list(size: Int) -> List[Int]:
var large_list = List[Int](size)
for _ in range(size):
large_list.append(1)
return large_list

fn main():
var size: Int = 100_000_000
var large_list = test_large_list(size)
print("List created successfully")

sleep(15)
print(large_list[10])
from time import sleep

fn test_large_list(size: Int) -> List[Int]:
var large_list = List[Int](size)
for _ in range(size):
large_list.append(1)
return large_list

fn main():
var size: Int = 100_000_000
var large_list = test_large_list(size)
print("List created successfully")

sleep(15)
print(large_list[10])
` Why is the memory consumption of my python process that not always the same? Also why is python here that much more efficent?
12 replies
MModular
Created by whatever on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
I have to write a "paper" for a college class and my idea is to compare the memory usage of python lists with differenrt objects in it and compare it to mojo. Maybe also compate it with numpy what would be more fair than python.
28 replies
MModular
Created by whatever on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
Sorry, set it up when discord made me change my old username and i was angry. No problem.
28 replies
MModular
Created by whatever on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
What would you recommend for mojo? Alternatively I would use something like top to capture the memory consumption of the process
28 replies
MModular
Created by whatever on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
thanks for your suggestions
28 replies
MModular
Created by whatever on 10/30/2024 in #questions
How can I see the peak memory usage of a datastructure like alist in mojo?
I will do it on a macbook m1 16gb ram
28 replies
MModular
Created by Mengbo_Zhou on 11/1/2023 in #questions
Mojo in llm?
I have to write a 5-6 page paper for college with something about transformers and my idea was comparing some implementation of it in python and mojo. Is this possible by now.? I thought about using a mini llm and testing it locally on my macbook
3 replies