Show newer

@fatelab 算卦 量子 最近找到一份可以接受的工作

我还说要科学算命,但科学说我死定了(

Show thread

坏了,一说到我要找工作,量子力学都不行了

@fatelab 算卦 量子 最近找到一份可以接受的工作

《缅甸诈骗集团提出“删视频就放人”,卧底记者照做,1小时人就被送到国门》
mp.weixin.qq.com/s/VjeW8KNswRY

⬆️看到这篇文章觉得卧底记者也太猛了……

@sdgathman

Compared to Java functions, yes, but overall no. According to StackOverflow, each JNI call is several nano seconds more compared to Java function calls. The main overhead is copying data from the Java heap to native memory. But if you use something like native buffer, there should be no such overhead.

If you load a big dataset in Java using a byte array, then you want to pass it to, let's say some BLAS implementation, then good luck copying all those data. But with native buffers, you can just pass the pointer of that buffer to the BLAS implementation and you're good to go.

stackoverflow.com/questions/13

@freemo @sdgathman

JNI is still Java oriented, which requires you to write some glue code to translate the difference between C and JVM world. (but with JNI, you can call Java code in C)

Now I'm using JNA, which is a black magic that automatically generates the proxy to call native shared libraries without any additional C code, with the cost of performance.

@sdgathman

But it looks like Jython only supports Python 2? Python 3 is still in the future...

@freemo

@freemo

It will be great if Python can be ported to other platforms. The flexibility of Python is great for exploring things like new network structures, etc. But once you have decided most of the specifications, it's better to use something like C or Java to build a more strong code base (so a typo won't screw you up, LOL)

And I have to say, I'm really jealous of Python on machine learning stuff, where JVM is (almost) completely being ignored until people need a more robust way to develop and only find out the Java is a complete nightmare to do operator overloading and have to write something like "a = a.mul(b)"

@sdgathman

@sdgathman

As a JVM lover, I am jealous of the ability to call C code directly from CPython.

And yes, coroutine is powerful. I'm using kotlin coroutines and it's a huge (free) improvement of Java's native thread.

@freemo co-routines can run on multiple threads, where the "tasks" can yield and the thread from a pool can switch to another "task" without suspension or something. At least kotlin coroutine can, and according to sdgathman, Python can do it too. That's the ultimate free boost you can get by just switching to another tech.

But if Python can do that, then my earlier hypothesis about switching to go will give your free boost is wrong

@freemo oh.. my bad. I did a quick google search and found Python is quite different from JVM. On JVM, a thread is always a kernel thread. On Python, it might or might not be (StackOverflow told me this). So when I initially thought about GIL, I thought it would be act like a monitor lock on JVM, which cause a kernel thread to suspend and have a relatively huge penalty.

And after another goolge search, yes, I do mean statically typed and strongly typed, where you need to declare the type of a variable and cannot change it on the fly.

@freemo ok, thanks, that's some updates to my knowledge base :ablobthinking:

Based on my experience on JVM, when I switched from JVM's native thread to Kotlin coroutines (which is based on threads but is able to share threads, so less thread suspension overall), I got a free performance boost. I assume go can achieve the similar thing. If so, I would say there is a free optimization without largely redesigning the algorithm.

Also, I always prefer strong typed languages when co-op with other developers. Python makes me panic when I don't know what the type of variable x :ablobgrimace:

@freemo @trinsec Based on my limited knowledge of python, the multithreading part is pretty heavy, if I recall correctly, you need a new python process to start a new thread (sounds familiar with JVM :ablobthinking: ). And go is pretty good at multithreading (I mean user-mode threads). If not limited by the IO, I would assume a go implementation will speed up some of the process. Maybe also ease the load on developers, considering go offers some great built-in multithreading structures.

@freemo @trinsec I do hear the matrix developers say there will be a go implementation to replace the slow and resource demanding python version. Is that still in alpha stage?

(As a jealous JVM lover, I don't trust Python 😂 )

I like this pic. It said: If life closes the door on you, then you open it again. That's "doors". And that's what they're for.

In case you're worrying (thank you!), I won't commit suicide. It's going to be hurt, and I'm VERY afraid of pain. But listening to an audio book while riding on a busy road, I got distracted several times and almost crashed into someone's car. You can't predict accidents, so I think it would be better to find someone to keep managing my data, which partially represented my life. Also sending an update of me, in case someone is wondering why this guy didn't post a toot for a long time (if there is anyone who cares).

I don't fear death, and I do want to enjoy my life. Unlike my parent, who will be triggered if I talk about death, I mean, people eventually die, why not tell your last wishes to others before you don't have the chance anymore? But it seems like this does scared my friend.😂

Show thread

I fixed my bike today. I find out riding is helpful when fighting with anxiety.

The front tire keeps leaking, and I replace it, only found out the leaking point is on the inner side. The rim strip has no visible and touchable damage, it shouldn't poke a hole in the inner tire. But anyway, the new tire is fine and the old tire is fixable (assuming I have the right tool).

Today I rode exclusively in the hutongs (aka the alleyways in Beijing). A random thought sneaks through my brain, suggesting I feel like a dementor (yeah, I was listening to Harry Potter during the ride. Specifically, the Prisoner of Azkaban), scraping others' happiness only to make myself feel better. And then post my negative thoughts on the internet and ruining someone else's day (sorry).

Anyway, hutong gives me a unique feeling about life. It's unlike streets, filled with cars and noisy crowds, the people living in hutongs are quiet, peaceful and relax.No matter what happens, people live here for hundreds of years. The fall of the Qing dynasty, the Eight-Nation Alliance invaded Beijing, the Japanese army, the Republican era, the establishment of the PRC, the Cultural Revolution, the three years of natural calamities (the Great Leap Forward), etc. A lot of things happened there. While I am constantly worrying about the current situation, I will be the history, and I was history. I am creating history (despite no one knows every detail about my life, but it does be the past, aka the history).

While I'm getting lost of the constant thinking of my life, this idea gives me some strength. I decided to try another job publishing platform and give it a try.

My friend suggested I should see a doctor, after I left my password to him and told him he will get my laptop and all servers if I died. Maybe he is right, but considering I'm still unemployed with no medical ensureance, maybe next time. LOL

Very interesting waterfall (spectrogram) of a dial up modem connecting. I can even picture where all the sounds come from I remember hearing as a child from the classic dialup connection.

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.