Git Product home page Git Product logo

Comments (3)

petr-tik avatar petr-tik commented on May 14, 2024

I would say there are several different tutorials:

  1. Running tests/benchmarks (people who will build this from source are likely to be interested in that I think)
    the readme mentions that JS outperforms lisp, but doesn't give instructions how to reproduce the benchmark
  2. Writing javascript to execute in emacs-ng/porting existing npm package to be emacs-ng runnable
  3. JS package management and integrating JS functions to be called by existing elisp

I ran fuzzy-search from here and then I ran fuzzy-search and it was async!

It would be amazing if we can integrate an async backend to a framework like ivy/selectrum or even write a new async backend. I work in a large codebase on a remote machine with slow storage that I have to tramp into and the usually interactive commands are dog slow and block the rest of my emacs to execute. I don't know how applicable it is, but I would be happy to contribute something to solve that (my rust is better than my C or JS though)

from emacs-ng.

DavidDeSimone avatar DavidDeSimone commented on May 14, 2024

I don't know where the best place to document on how to reproduce the benchmark it, though it's pretty simple:

benchmark.el

(js-initialize)
(defun fibonacci(n)
  (if (<= n 1)
      n
    (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))

(let ((time (current-time)))
  (fibonacci 40)
  (message "%.06f" (float-time (time-since time))))

(let ((time (current-time)))
  (eval-js-file "./fib.js")
  (message "%.06f" (float-time (time-since time))))

fib.js

const fib = (n) => {
    if (n <= 1) {
	return n;
    }

    return fib(n - 1) + fib(n - 2);
};

fib(40);

run with ./src/emacs --batch -l benchmark.el

The latest head of master without nativecomp clocks in with this on my machine:

lisp: 58.584704
JS: 1.203173

time in seconds.

The nativecomp version is just compile with nativecomp, compile that function with nativecomp and invoke it.

from emacs-ng.

DavidDeSimone avatar DavidDeSimone commented on May 14, 2024

I'm going to mark this complete, and will track additional guides under a new issue.

from emacs-ng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.