vfox icon indicating copy to clipboard operation
vfox copied to clipboard

[Question] Is wrong command in your benchmark?

Open NamPNQ opened this issue 1 year ago • 5 comments
trafficstars

Follow your command to benchmark, you run node -v for vfox, and just node for asdf image

The result is very difference when run the same node -v, in my machine, the asdf is faster

image

Version 0.4.1

OS macOS

NamPNQ avatar Apr 22 '24 15:04 NamPNQ

I wanted to fill a new issue, but I found this one and decided to continue on performance complaints here.

So I waited until https://github.com/version-fox/vfox/pull/188 became available and tried it this morning. The first thing that I noticed is that when I press the 'enter' key, my command prompt is redrawn with some noticeable delay. It's very small but still noticeable. I used fnm before and did not notice any "big" delays with it.

is it something that can be looked into?

ps: latest macOS in 13th version, latest fish and latest kitty

ZuBB avatar Apr 22 '24 17:04 ZuBB

I did a quick benchmark and here are the results.

image

Performance has decreased, I need to find out what case this issue.

aooohan avatar Apr 23 '24 01:04 aooohan

So I waited until #188 became available and tried it this morning. The first thing that I noticed is that when I press the 'enter' key, my command prompt is redrawn with some noticeable delay. It's very small but still noticeable. I used fnm before and did not notice any "big" delays with it.

https://vfox.lhan.me/guides/configuration.html#legacy-version-file

As mentioned in docs, if this feature is turned on, it may cause refresh environment variables slightly slower

aooohan avatar Apr 23 '24 01:04 aooohan

So I waited until #188 became available and tried it this morning. The first thing that I noticed is that when I press the 'enter' key, my command prompt is redrawn with some noticeable delay. It's very small but still noticeable. I used fnm before and did not notice any "big" delays with it.

https://vfox.lhan.me/guides/configuration.html#legacy-version-file

As mentioned in docs, if this feature is turned on, it may cause refresh environment variables slightly slower

I understand that additional checks are not free. But I don't understand why handling a .tool-versions file takes a really small amount of time and handling a .node-version takes a way bigger amount of time. The difference is huge. If we compare those two files, 2nd one should be processed faster as it contains data on only one particular runtime.

Do you have any idea why we have such a big difference?

Also, I noticed that the config file gets really weird ACL. Why did it suddenly become executable?

vv@my-precious ~/.version-fox $ ls -l config.yaml 
-rwxrwxrwx  1 vv  staff  98 Apr 23 23:13 config.yaml
vv@my-precious ~/.version-fox $ 

EDIT: the whore redraw issue happens only in dirs with .node-version(/.tool-versions) files.

ZuBB avatar Apr 24 '24 06:04 ZuBB

I understand that additional checks are not free. But I don't understand why handling a .tool-versions file takes a really small amount of time and handling a .node-version takes a way bigger amount of time. The difference is huge. If we compare those two files, 2nd one should be processed faster as it contains data on only one particular runtime.

Do you have any idea why we have such a big difference?

There are two factors:

  1. You can view $HOME/.version-fox/.legacy_filenames file to view all filenames that need to be match.
  2. We need to focus on how vfox-nodejs plugin implements to parse .node-version file.

There is a strategy here. First, match the locally installed version. If it does not match, then match the remote version, that will call Available hook, this involves network IO and will seriously affect the speed.

I think it may be caused by this.

https://github.com/version-fox/vfox-nodejs/blob/aa6dc5faeba6cd354e83966f66a88cd6feef2204/hooks/parse_legacy_file.lua#L34-L41

Also, I noticed that the config file gets really weird ACL. Why did it suddenly become executable?

vv@my-precious ~/.version-fox $ ls -l config.yaml 
-rwxrwxrwx  1 vv  staff  98 Apr 23 23:13 config.yaml
vv@my-precious ~/.version-fox $ 

Because I was going to do some advance preparation for solving #51, but I did it wrong. This file should be readable and writable. : (

aooohan avatar Apr 24 '24 06:04 aooohan