Science
Related: About this forumPython 3.14 Will be Faster than C++ (Not really)
Article is about the new version of Python programming language. The author uses a variation of the Monte Carlo algorithm to estimate the value of Pi. https://en.m.wikipedia.org/wiki/Pi
Excerpt
Python is one of the most used scripting languages in data science (DS) and machine learning (ML). According to PopularitY of Programming Languages Python is the most searched language on Google. Next to being a great glue language to connect various DS/ML solutions together, it has many libraries to virtually do anything with data.
In about a month we get a fresh new yearly release of Python: version 3.11. I am quite excited about this new version as the main feature for this version is a significant increase in speed.
On LinkedIn I have already seen a couple of post of people testing the new version and their results were stunning. But the best method to get a feeling on how fast Python 3.11 truly is, is to run the tests yourself.
https://towardsdatascience.com/python-3-14-will-be-faster-than-c-a97edd01d65d?gi=660d39c1c7ae
Hugh_Lebowski
(33,643 posts)I'm actually a DBA/SQL coder but OOL's are not unfamiliar, I know a bit of Java and PHP ... more like I can read them and figure out what they're doing, but coding from scratch myself is a bit of a challenge.
Actually taking a Python tutorial for work right now, Codecademy
BootinUp
(49,023 posts)For our lab data. The Monte Carlo algorithm always fascinated me. It was used long before computers.
Edit correction. I was thinking of another algorithm but the Monte Carlo is also fascinating https://en.m.wikipedia.org/wiki/Monte_Carlo_method
Hugh_Lebowski
(33,643 posts)But we have others on mySQL and some legacy Oracle stuff (which I hate).
Another task today is converting some SQL Server scripts to mySQL format as we need the same functionality on both platforms.
Thing that's pissing me off right now is that
Select top 1 * from table; (mssql)
and
Select * from table limit 1; (mysql)
Don't always work the same way. I mean if the query is THAT simple they do, but start adding a lot of other stuff (most of my queries are beasts), and they don't. Frustrating me as we speak
BootinUp
(49,023 posts)Also worked some with MySQL. I totally understand well a little anyway. Soon it will be Miller time.
BootinUp
(49,023 posts)Not too long ago I worked out why a query didn't sort like I expected it to. A dash character in a NCHAR data type was what made it sort strangely. NCHAR type is unicode. I changed the data type to CHAR and that worked for me. Been too long since I worked with MySQL 9 years, to remember specifics about it.
Edit: It could have been NVARCHAR to VARCHAR too, I don't do this stuff everyday.
lapfog_1
(30,156 posts)I looked at the article, the author does a number of tests with different versions of python to show that the interpreter (python is interpreted, not compiled) is getting faster and faster with each version. Then the author PROJECTS that future versions of python will continue to exhibit the same increase of speed compared to the previous version... a huge assumption, and projects an intercept point to his other language C++.
Of course this is fallacy.
That's similar to charting the temperature of a city in the northern hemisphere from winter to summer... and then predicting that (after some more time) that city will be as hot as the sun.
I guess I'm "that one guy" the author sort of dismisses.
I pick the correct language to write software for the application and requirement. C is useful for things at are in or near the kernel of the Operating System and which are run frequently and need to be executed taking the least amount of resource. python is good for data analytics, building software quickly, and you don't care so much about execution speed or resource usage, scripting language for those Q & D things you want to prototype.. and which have a limited scope, where you really don't case about speed or resource. Same with Java and javascript, html, etc.
And... some scientists are just married to using matlab and Fortran for doing their complex numerical modeling.
when you go build a house, you don't just take 1 hammer in the toolbox.
BootinUp
(49,023 posts)Finish the article. It was not a serious statement as you guessed and as I indicated in the thread title. Both the author and I are certainly going to agree with you about choosing the right tool.
mike_c
(36,333 posts)I used it for a good ten years, once per semester to format class and lab schedules for my syllabi, .
BootinUp
(49,023 posts)it was my first time using it. Pretty powerful.
SorellaLaBefana
(229 posts)After all, if it is simply execution speed which is paramount, then the only answer is the chip's native machine language bypassing any OS.
Of course, writing ML is functionally impossible for humans however assembler will do the job (years ago I put in my time here coding video drivers). Even so, it's hard to get it right in a finite amount of time even if you do use hooks to an OS for leverage. And, when you are all done, the result will only run on a particular architecture
It is also discouraging when you write a routine in assembler and in C and then find that the C is faster. Disassembling the complied C, you see where you went faceplantingly wrong
My actual point, is the same as yours: Language Wars totally miss the point. Use the Right Tool for the job. This is something which is often forgotten
Jim__
(14,456 posts)Codon - write Python code and then its gets compiled by a Codon compiler.
From TechXplore:
Codon is a Python-based compiler that aims to democratize high-performance computing. Credit: Alex Shipps/MIT CSAIL via Midjourney
__________________________________________________________________________________________________
...
The high-level language has earned its popularity, too, with legions of users flocking daily to the language for its ease of use due in part to its simple and easy-to-learn syntax. This led researchers from MIT's Computer Science and Artificial Intelligence Laboratory (CSAIL) and elsewhere to make a tool to help run Python code more efficiently and effectively while allowing for customization and adaptation to different needs and contexts. The compiler, which is a software tool that translates source code into machine code that can be executed by a computer's processor, lets developers create new domain-specific languages (DSLs) within Pythonwhich is typically orders of magnitude slower than languages like C or C++while still getting the performance benefits of those other languages.
DSLs are specialized languages tailored to specific tasks that can be much easier to work with than general-purpose programming languages. However, creating a new DSL from scratch can be a bit of a headache.
"We realized that people don't necessarily want to learn a new language, or a new tool, especially those who are nontechnical. So we thought, let's take Python syntax, semantics, and libraries and incorporate them into a new system built from the ground up," says Ariya Shajii, Ph.D. , lead author on a new paper about the team's new system, Codon. "The user simply writes Python like they're used to, without having to worry about data types or performance, which we handle automaticallyand the result is that their code runs 10 to 100 times faster than regular Python. Codon is already being used commercially in fields like quantitative finance, bioinformatics, and deep learning."
The team put Codon through some rigorous testing, and it punched above its weight. Specifically, they took roughly 10 commonly used genomics applications written in Python and compiled them using Codon, and achieved five to 10 times speedups over the original hand-optimized implementations. Besides genomics, they explored applications in quantitative finance, which also handles big datasets and uses Python heavily. The Codon platform also has a parallel backend that lets users write Python code that can be explicitly compiled for GPUs or multiple cores, tasks that have traditionally required low-level programming expertise.
more ...