Codesandbox-client: Console.time almost always shows 0ms in CodeSandbox console - but real results are available in the browser's console

Created on 2 Nov 2020  路  6Comments  路  Source: codesandbox/codesandbox-client

馃悰 bug report

Preflight Checklist

  • [x] I have read the
    Contributing Guidelines
    for this project.
  • [x] I agree to follow the
    Code of Conduct
    that this project adheres to.
  • [x] I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

I'm doing some benchmarking and I noticed that when dealing with times like 24000ms, instead CodeSandbox shows 0ms, or in some cases 1ms.

image

To Reproduce

Link to sandbox: https://codesandbox.io/s/infallible-tdd-ex27s?file=/src/index.js

Your Environment

| Software | Name/Version |
| ---------------- | ------------ |
| 小odesandbox |
| Browser | Firefox 82
| Operating System | Windows 7

External Dependency

All 6 comments

Thanks for your bug report. I can indeed reproduce this. We're going to investigate, and will get back to you.

Seems to be an issue with Console Feed in Firefox, trying to figure this out with Sam that made console-feed

@SaraVieira @sannek actually the issue exists in Chrome too. Although the output in Chrome differs from that in Firefox, neither matches the output in the console.

I noticed but honestly also not fully sure how close you can even get when its a console emulation 馃

@SaraVieira what stood out to me was the way the outputs differ.

In Chrome the emulated console shows: merge: 0.3850000211969018ms

But in the real console it shows merge: 25476.956298828125 ms

Maybe it's not at all surprising since Chrome natively includes fractional milliseconds and Firefox does not - but it struck me as odd since I figured whatever logic caused this issue would cause the same issue in Chrome.

Ever since I started working on CodeSandbox I found out a lot of things come from the underlying architecture of the browser and even sometimes how that browser would even interact with the OS underneath.

It is a weird one tho and I will keep you updated

Was this page helpful?
0 / 5 - 0 ratings