I took a simple algorithm randomly on the web, I wanted tested fastly….
You can see the result (yeah,I know, messy, and comment in french !) : my test
The result is interesting ! First the number of thread allow by Chrome is very few: 4 only. Same for firefox… Compare to the true number in actual CPU, it is very few !
The algorithm I took is little special: compute between 0..10000 is lot more fast than 100000..110000.
So as a result : At begin I forgot one thread do only one computation ! So I have in this case to do an array of worker…Perhaps more smart to expose something like “clone()”… Or to do it without ask the programmer ?
So my first test was not so good but, If I go in big number: Chrome die in normal way, not on worker.
we go from 3.2 s to less than 2s…but this algorithm is really a special case.
My second test was more “smart”: I don’t send my 4 thread on 1/4 of data, but i send 4 thread on small parts, And I reutilise them when they did the work.
Even my source are messy, it is not so complicate to understand I think. so from the classical algorithm,we go from 3.2s to 0.45s.
The step of data I give look important, I tried many value. too small was bad as 1.4s, to the best who was 0.45s.
Talking to my friend Pascal about webworker and gpujs, we had like a brainstorming. “It will be nice if we can transform a code without sideeffect on gpu and/or webworker!”
I thinked a bit about it, funny idea… After it I looked about how is made GPUJS, fastly… It use a library for make an AST of your code, and transform it in a shader. Very good, but shader have lot of limitation:
in input, you can have just constant, and until 3 arrays of 1 or 2 dimensions.
avoid “if” instruction as hell, and when you write in JS, it is not the natural way to think.
But that’s still possible: give to GPUJS a code, and if it fail to compile, was not good!
but it need prepare the input parameters…Bit difficult.
What we can improve, and when that’s can be usefull ? First, in one case,we have a problem : if the function use global variable.
We can detect it by try call comand in a try catch, and error will appear in such case.
More difficult: if it use gloabl variable BUT don’t change them… need an AST tool in such case.
We can also make it a “promise” in easy way.
Another bonus: we can make it webworkker AND memoize ( just a strange word for say: “if this function is pure, same arguments, will give same result, let’s do a cache !!!”)
but more !
As I say we can make them look like a promise…with a big benefits on real promise !
Let’s look to the API Promise in javascript : Most of the time, just await and async are enough, but not in all case as : mdn doc on Promise.any
In such case, we continu execution if ONE function is finish….but the other continue ! Let’s imagine a sitation as:
try get a data on indexedDB (fast,but not sure)
or get by AJAX to cdn1
same cdn2
take it a complicate and slow way
With promise.any …. yes that’s work, you have your data as soon as possible but the other stuff continue !!! As webworker have a “terminate()” function, we don’t have this problem.
Thank you for reading ! I will try post on such subject soon !
Windows (who try keep the base of code since 1995, who sell fix to their bug, each 3 year ! )
MacOSX : I don’t see new concept in it since long time, based on UNIX
Linux : In my opinion the best, but still based on amazing old concepts
Before, we hqd lot of choice,as GEM , BEOS, Workbench… And some have concept who are interesting. Let’s detail it.
Concept I want :
reboot without need permission of my computer !
As with my Atari, i want stop my computer WHEN I WANT. Sorry, but each time “my” computer tell me “heho, wait for i wake, wait for turn me off…” I feel like I am his slave, should be opposite.
For do it is bit easy : we have amazing cheap static memory now ! So with two buffer, we copy the state actual of the computer (two because if you stop suddendly,one was in writing, the other is OK!).
change the old FAT32 system (omg, we still have it ??? )
BeOS file system was interesting too : If you think as a computer, directory and path is a strange stuff, make for human. And even as human…We all have a Video directory, document for work (word, excel)…and that’s near all ?
The name of file is also an “alias” for human, that’s all…
So what I propose is:
A list of GUID => these file In a SCHEMATIC way : GUID list Of Path (so,same file can be used at many place, that’s transparent for you) size, type ((MIME type) With this way, we can have many benefits:
no double files (who never have it ? or DLL installed by programs etc)
if we lost a file who is “famous”, we can use git or torrent or take it from the cloud (as google drive,one drive etc…are free or near)
with a GIT way of do save , we keep all history at each writing : if a program don’t do UNDO/REDO,no problem, we have it on all file !
the size of a directory is show in direct, no need wait 15 minutes like now
move/copy file is also instantany : just need change one line in a text file.
if we are many user on same computer, no need copy comon
For security reason, computer memory (yes, memory and harddisk is another silly old concept, we don’t need anymore ! )are in two part: Public and Private : if a user “torrent” you a file, we just search in public, of course.
more easy programming API
Actually we have a lot of good library, tested and used by near all programming langage.
Let’s use them. As they are high level, well optimised, we choose them, and stop have 10 levels of API. By ten levels API, i want say : APi, who call API of API OF API…..as now !
Computer are actually enough fast for don’t care of 10 CPU cycles…
The basic API must include :
easy read and save file (without care if it is in the cloud, in memory,in static memory…the user choose it, not the coder)
easy display/ extraction of data (read all comon file as CSV, Video, Sound, 3d standard, JSON)
lot of meta information easily, lot of possibility to transform easily from type to type, to manipulate it.
for the user, the most reader/editor possible, have a default choice, but other choice if he want.
for the programmer : easy way to use all thread and gpu thread. (to be continued…)
For test the concept
My choice is actually a raspery PI, as it is cheap for everobdy and fast. It will boot on a NW.JS (it is like Electron, but for me, it is lot more easy and productive) pages : it will be the GUI of the SOBAF. basic look
This page is about one weeks of work, so it is 0.0.1 of the look.
This page actually load lot of predefines library, and propose it to the “windows” (that’s local page in windows OR Iframe, perhaps only IFrame at end as NW.JS is very cool on the subject !) I include for libraries : ()
tool_ihm.js (a little toolkit I make, perhaps not the best one,and perhaps will be removed or improve)
jsframe.js, make the frame/iframe OS Like
fontawesome, many icon, draw etc
bootstratp4, CSS only for now
Ace, a code editor with many langages+ plug in
esprima, who make Javascript to AST
markdown-it, transform md file to html (and many other format)
Soon I will put many other AST I think. Why so lot of AST ? why of concept of SOBAF is to make the power of your computer serve you ! And about it AST is usefull, from natural processing langage (watch unified on this point) to programming.
When you program, as fast as you can type, that’s evident : your computer is bored ! So with the AST, I want make it work on what you program, for example : Test a part of the tree with random value (before we call it monkey test) Try to extract part who can be on another worker or gpuworker Test the difference between stay on mainthread or not, usefull or not ? If it is usefull and possible to be on GPU, compile it without ask you !!! Compute metric Refactoring, and opposite, inlining If you give good information (for example human age, so between 0..160): try test 0,160, random, try all if possible. With as AST you can also generate easily an GUI for a part of program : imagine you have a function who take two string, and you want test it fastly …. Why you need to write yourself two input box To put them “type=string” , to do a submit button ? computer can do it so easily, without anywork.
I try to, based on schema JSON to do viewer,editor,validator easy and smart : if we have a GPS position, that’s means of course,no number >360. We can display a map for visualize it or enter it…it can be by tag it as GPS (metainformation). Or just watch the {lat,lg} and infer it should be a GPS position.
from a package.json, in the file explorer, show “run” command in an IHM way.
integrate GIT (isomorphic library)
save in editor the js, etc as a tree: no more plain text file, bye bye !
add/mofication to Sobaf
add a system file ( https://jvilk.com/browserfs/ ) (it can read/write sync or Async, from memory, localStorage, indexedDb, dropBox, ajax)… Big copy of the node.js “fs” system, very cool, no ? I just need put a versionning system in front of it ( when i wrote “text.txt” also wrote “test.txt.”+universaltime)
integrate my little library “Modeling Language”) : ML => transform an human readable Data description, fast to write, to a JSON Schema and with the help of the cool json-editor, transform it to an IHM, with validator
MD reader and writer (bcos in most of case, it is full enough for a static page, no need HTML for it !!)
ACE editor (lot of languages read and plug in) (perhaps test Monaco, the vscode editor ?)
They are addictive, take care ! ( promise I also translate menu of the game soon :-)
I work on a infinite crossword generator too, browser side.
Magic Logger
The goal of project is to record all events, and all console event, to send them by ajax,websocket, stock them of localStorage, be capable of replay the user action, have performance, to see them on screen, to select them with an interactive interface.
Video editing
A project Windows / MacOSX / Linux. The goal is to make an editor for video, and encode them really faster, for mid-professional people.
Traduction tool for professional
Even if Google Translate and other are not bad, for professional website, they can not are just an help….professional have big need, like context, exception, change the size of text, change photo, know if they are in full text or tooltips.
MyBrowser
As a programmer I have some big need not really cover by chrome, so from NW.JS, I want do my personal browser.
Idea of feature :
selector => action , for what I want ( like hide the menu in wikipedia, and put the font of the article at maximum for the article), save by website.
in context menu, see synonyms or definitions or pop up or preview of wikipedia article of a word I don’t know… useful for learn new language…perhaps even google photo !
in google, give and sort by date when I am in “code” profile.Some API do it.
kill z-layer, in many case,the Z layer hide,if display : none ,we can see website :)
alert,prompt,ask permission,my position : useless :)
cascade no volume : if a website is mute,if it open another webpage she must be mute (inheritance of mute…)
by iframe, open in same tab, not other,so i can see all in same page. Means i see google AND the result in same tab
if I want, preloader all “next link” for win time if I surf on a website
display the sitemap, for navigate directly where I want
exchange some presets with friend
Assistant for user of administration
Some people have big problem for use website, so they need be helped,but they also type slowly or don’t understand some special word…. the helper can control their keyboard/mouse on the website, show them how to do, talk and video with them. Also nice for teach.
from CLI to GUI
More and more CLI project exist…but normal user don’t like. Or just,as they all have different syntax,that s bit hard to remember Normally,an user don’t use all the CLI of a program They use just 5 or 6 CLI command …. So, let’s automate CLI to GUI And exchange them,of course ! For example the team leader do cli command for the designer, and they just have to click after… You put a label, and that’s all. Without know nothing of what user do, he click on “publish”… The user don’t have more learn mre for collaborate. And if all change from github to gitlab…they don’t have to know ! nothing change for them !
Interactive Video Generator
This project is near finish, and permit to do lot more than other editor. BTW it is for professional, not for everybody.
Near finish.
My own format for data
Also near finish, my format is very easy to learn, for very normal user oriented (not IT specialist I means ! ) and permit :
generate an HTML GUI, with validators
generate JSON Schema with validators
To generate a database Schema
To have some random data inside it for testing purpose
To Generate a documentation in markdown ( from markdown, you can translate to PDF, HTML, etc)
This project is finish at 90%. The parser work yet !
I really love use Node as a “Super .bat” ! So I do tools for my daily life as :
A watcher for save my source at each save action, It put my source in save place,and add a timestamp for forever undo.
Another watcher transform my new pictures and video in webpages.
A tool for detect 404, break image, etc. On a local, not local, or cordova application.
Really when you a little toolbox ready, make a new tool is funny and fast !
A Realtime Oriented Video Player for teacher
On your the webcam view, you can decide to display what you prepare before (power point, link etc)… When the video is off, all this link are available to student. You can even do some little exercises for see if student have understood you, in realtime.
Universal Source Format
I think about it since long time, and i have bit time now for do it. Text file are really a bad system for Source code, you don’t think so ? It will be much better to stock them on AST in fact. And to see them this way. Advantage :
as a tree, you can do like your repertory ! Copy, cut, paste…It is one file or one million on your computer, who cares ?
as a tree, you can compare very faster difference… No need to checksum one million of file. So you can stock, send, easily the delta. Who cares it is line 234 in thing.js ? no, you want see whats happened in the project, that is all.
as a tree, you can lock easily a part of tree… No need silly merge as we do now…Really, you are ten peoples on the same files, and you ask yourself why u make bugs ? OMG…
refactoring is easy…Look if two subtree are exactly same is easy. The opposite too : you can copy/paste a part of tree for change it for a specialize this part of code.
lot of tool can be done very faster, for example test a part of tree, unit testing…it can even be automated very easy…As you can visualize easily what part of the tree was never called for example.
as it is AST, you can specialize the rendering, means…I can have in my editor : If you prefer :
1 2 3 4 5
if (text="fred") begin inst() inst2() end
No ? prefer C way ?
1 2 3 4
if (text=="fred"){ inst(); inst2(); }
The semantic is exactly the same …Choose the one you like, but don’t force other to do same…as we can export theme of keyboard shortcut, just export your C or Pascal way… If you prefer read “2+2” or “2 plus 2”, for the computer, it is exactly the same.
For example, some people love ternary operator, some hate that, but it is just the same at end, so, let’s choose how you want see your code, and how they want see …
Another use of AST : versionning version. If a change is made, you can still use the old version,no problem.
You can put very good informations too, as we do in assert in TDD. When you program, the computer test for you this part of your code, always.
Modern Novel
This art project is to about modern live… Take for example 5 peoples who live together, and display their social interaction in realtime.
For example, Fred receive an SMS, but have whatsApp webcam in same time… You can check the phone if you want, but webcam session continue, and Stephanie, in other room have also a webcam session with other people, and Mohamed just receive an e-mail…
As it is realtime, you can not see the two webcams in same time… So if the story is one month long, you can not have all information ! Like that, you can “read” again this novel, and always learn new stuff you did not know because before you dit another choice…
Webcam Exchange Worldwide
This art project, is about make some communities worldwide.
Imagine you are in a jazz bar in Milan, and on many screen ( cheap now, and we all an old phone or tablet we do not use) you can see another jazz bar at Tokyo, New York, Le Cap, and Tunis ! not for talk (but if you want, why not) , just like some Windows on World.
Imagine you do your hair cut, and you watch the world, by these windows, and see an indonesian guy and a london lady who do same as you, and you can talk to them, exchange, see cultural difference…
Lot of place can be like that : the screen is just a windows on other. Before it was fashion to put the time of other capital in the world in cool place…I want do it with time AND image !
Penser sur le parallélisme genre GPU pour processeur
Pour commencer, je ne pense pas être le 1er avoir eux cette idée bien sur. A l’heure actuel, une nouvelle façon de compter la complexité d’un algorithme est apparu, se basant sur le parallélisme. On peut donc dire O(n) pour un algorithme classique. Et O(N,P) P étant le nombre de parallélisme possible.
Un pixel shader actuellement, et nous en avons vraiment énormément que ca soit sur votre telephone portable ou votre ordinateur,est aussi puissant qu un ordinateur des années 90. De cet façon, certain mauvais algorithme, deviennent bon, mais d autre, bon avant mais pas du tout parallélisable, deviennent mauvais !
Imaginons que vous devez trouver le plus grand float dans 4 giga de donnees. En pensant de facon normal, il n y a aucun choix : il faut tout parcourir
En pensant en //, le problème devient beaucoup plus simple : chaque processeur fait un bloc d’une certaine taille, et envoie a une position sont résultat…puis ce bloc est a son tour fait ainsi…
L execution est devenu énormément plus rapide.
Autre exemple : Imaginons un arbre binaire non trier,et nous cherchons un noeud specifique.
Avec un seul CPU, pas le choix : on doit parcourir l arbre entier jusqu a la fin.
En parallèle, cela devient different : l algorithme dit en fait “je vais gauche,puis droite” en permanence avec un seul CPU. donc, pour la 1er iteration : ( G pour Gauche,D pour Droite ) GGGGGGGGG 2eme : GGGGGGGGD 3eme : GGGGGGGDG puis GGGGGGGDD
bref avec 0 pour G et 1 pour droite, on obtient : 000000011 pour le dernier
Ceci permet d’encoder le parcours a suivre pour le processeur N.
Donc pour un arbre de profondeur de 1024, 1024 CPU suffisent, et la complexite est constante : O(1024) soit O(1) .
A voir : GPU.JS pour tester sur JS ce concept. Ou Julia qui permet de compiler sur cpu et gpu.