AlbertoPdRF / root-file-viewer

View ROOT files directly in VS Code!
https://marketplace.visualstudio.com/items?itemName=albertopdrf.root-file-viewer
MIT License
47 stars 5 forks source link

Add progress indicator when loading large trees #11

Open dnwerner opened 3 years ago

dnwerner commented 3 years ago

It would be very helpful to show a progress indicator while loading large trees, because sometimes loading apparently stalls and loading of large trees can take quite a while.

AlbertoPdRF commented 2 years ago

I believe this is something that should be handled in JSROOT's side, so I'm adding @linev to the issue so he knows about your suggestion! :slightly_smiling_face:

linev commented 2 years ago

Probably I understand source of the problem.

Seems to be, inside WebView JSROOT tries to load content of complete ROOT file. May be WebView does not support partial requests.

@AlbertoPdRF, can you point me place in the code where access to ROOT file is provided?

With normal HTTP progress bar appears and JavaScript VM in browser uses moderate amount of memory (~10MB)

https://jsroot.gsi.de/latest/?file=https://jsroot.gsi.de/files/tmp/large.root&item=ntuple;133/px

AlbertoPdRF commented 2 years ago

I'm not entirely sure where to point you. Do you mean this line? Or this function?

The first is when I think that the file is actually being read, but I don't know if it's loaded in memory or something before. The second is the function VS Code calls with a file uri for our extension to return a new CustomDocument for that resource, but in our case everything that should happen at this point is that the uri gets saved for later usage.

linev commented 2 years ago

Yes, this is exactly I was asking for.

And most probably here partial reading is not works. All kinds of such interfaces ignores "Ranges" settings in requests.

The only solution would be: https://code.visualstudio.com/api/extension-guides/webview#scripts-and-message-passing

I can add support for arbitrary I/O proxy to JSROOT. Once it is there, we could try to use it inside WebView

AlbertoPdRF commented 2 years ago

If you think that could work, I'm down for it!

linev commented 2 years ago

@AlbertoPdRF

I trying to use your extension from local disk, but somehow fail. That exactly I should do to get it running - I want to test changes concerning large files reading

AlbertoPdRF commented 2 years ago

From the base folder of the extension, in a terminal:

  1. yarn
  2. code .

Once VS Code opens:

  1. F5

I believe it should be enough with that, let me know if you have any problems!

linev commented 2 years ago

Now I got it! I create PR - only to show code: https://github.com/AlbertoPdRF/root-file-viewer/pull/20

Can you check how node modules can be used inside?

linev commented 2 years ago

Finally PR #20 is working with large files. Also images can be stored directly. One also can enable back 'tabs' layout - JSROOT master supports it now

dnwerner commented 1 year ago

Is there any progress on the issue? On slow internet connections some files containing ~150 histograms (mixed TH1 and TH2, file size: 60 MB) start to load, but simply stop after a while (the loading indicator just vanished and nothing happens anymore). Are there internal timeouts interrupting the loading progress?

AlbertoPdRF commented 1 year ago

Hey @dnwerner, sorry for the very late reply, I was busy finalizing my PhD and other stuff.

Sadly, there has never been a reply by the VS Code guys regarding the issue blocking #20. I will try to look for a workaround to land it, as it's been way too long now.

dnwerner commented 1 year ago

Hey @AlbertoPdRF,

no problem! Thanks for the reply and good luck with your PhD! :) I currently work around the issue by manually copying the files I want to view onto my machine and accessing them locally (not ideal, but no deal breaker).

If you find the time, the larger problem for our team currently seems to be #3 (bright text on white tabs).