Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toString as '[Object object]' in a vm #281

Merged
merged 4 commits into from
Sep 13, 2022
Merged

Fix toString as '[Object object]' in a vm #281

merged 4 commits into from
Sep 13, 2022

Conversation

dcousens
Copy link
Collaborator

@dcousens dcousens commented Sep 13, 2022

Builds on #255, thanks to @markdalgleish for the base code.
This pull request shortcuts the toString.toString() workaround by ensuring it fails the existing arg.toString !== Object.prototype.toString first.

Seeing as toString is an edge case in the first place, this balances our performance by having low to no impact in typical usage.
We have the option to shortcut with hasOwnProperty('toString') if that code path is desired, but I have opted out of that for now.

Benchmark results for this pull request

Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
* local#strings x 9,997,500 ops/sec ±1.21% (64 runs sampled)
* npm#strings x 10,106,445 ops/sec ±0.79% (66 runs sampled)
* local/dedupe#strings x 2,056,185 ops/sec ±0.34% (67 runs sampled)
* npm/dedupe#strings x 2,144,413 ops/sec ±0.25% (68 runs sampled)

> Fastest is npm#strings | local#strings

* local#object x 6,763,187 ops/sec ±0.80% (67 runs sampled)
* npm#object x 6,685,687 ops/sec ±0.91% (67 runs sampled)
* local/dedupe#object x 3,986,428 ops/sec ±1.21% (38 runs sampled)
* npm/dedupe#object x 3,955,846 ops/sec ±0.54% (66 runs sampled)

> Fastest is local#object | npm#object

* local#strings, object x 6,075,125 ops/sec ±0.94% (66 runs sampled)
* npm#strings, object x 5,996,929 ops/sec ±1.22% (64 runs sampled)
* local/dedupe#strings, object x 2,003,171 ops/sec ±0.64% (67 runs sampled)
* npm/dedupe#strings, object x 2,007,377 ops/sec ±0.43% (67 runs sampled)

> Fastest is local#strings, object | npm#strings, object

* local#mix x 3,123,072 ops/sec ±0.60% (65 runs sampled)
* npm#mix x 3,178,872 ops/sec ±0.69% (66 runs sampled)
* local/dedupe#mix x 817,797 ops/sec ±6.46% (62 runs sampled)
* npm/dedupe#mix x 821,086 ops/sec ±4.42% (64 runs sampled)

> Fastest is npm#mix

* local#arrays x 1,199,652 ops/sec ±0.97% (63 runs sampled)
* npm#arrays x 1,150,411 ops/sec ±2.05% (62 runs sampled)
* local/dedupe#arrays x 716,685 ops/sec ±1.22% (65 runs sampled)
* npm/dedupe#arrays x 755,361 ops/sec ±0.39% (67 runs sampled)

> Fastest is local#arrays

Finished

bind.js Show resolved Hide resolved
*/
/* global define */

(function () {
'use strict';

var hasOwn = {}.hasOwnProperty;
var nativeCodeString = '[native code]';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable seems unused :-)
(not a big deal)

CrispyBaguette pushed a commit to CrispyBaguette/wasm-palette-converter that referenced this pull request Nov 8, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [classnames](https://github.com/JedWatson/classnames) | dependencies | minor | [`2.3.1` -> `2.5.1`](https://renovatebot.com/diffs/npm/classnames/2.3.1/2.5.1) |

---

### Release Notes

<details>
<summary>JedWatson/classnames (classnames)</summary>

### [`v2.5.1`](https://github.com/JedWatson/classnames/blob/HEAD/HISTORY.md#v251--2023-12-29)

[Compare Source](JedWatson/classnames@v2.5.0...v2.5.1)

-   Remove `workspaces` field from package ([#&#8203;350](JedWatson/classnames#350))

### [`v2.5.0`](https://github.com/JedWatson/classnames/blob/HEAD/HISTORY.md#v250--2023-12-27)

[Compare Source](JedWatson/classnames@v2.4.0...v2.5.0)

-   Restore ability to pass a TypeScript `interface` ([#&#8203;341](JedWatson/classnames#341))
-   Add `exports` field to package ([#&#8203;342](JedWatson/classnames#342))

### [`v2.4.0`](https://github.com/JedWatson/classnames/blob/HEAD/HISTORY.md#v240--2023-12-26)

[Compare Source](JedWatson/classnames@v2.3.3...v2.4.0)

-   Use string concatenation to increase performance thanks [Jon Koops](https://github.com/jonkoops) ([#&#8203;336](JedWatson/classnames#336))

### [`v2.3.3`](https://github.com/JedWatson/classnames/blob/HEAD/HISTORY.md#v233--2023-12-21)

[Compare Source](JedWatson/classnames@v2.3.2...v2.3.3)

-   Fix default export, thanks [Remco Haszing](https://github.com/remcohaszing) ([#&#8203;301](JedWatson/classnames#301))
-   Fix types for read-only arrays, thanks [Ben Thompson](https://github.com/BenGearset) ([#&#8203;307](JedWatson/classnames#307))
-   Replace README examples with functional-style components, thanks [JoeDGit](https://github.com/JoeDGit) ([#&#8203;303](JedWatson/classnames#303))

### [`v2.3.2`](https://github.com/JedWatson/classnames/blob/HEAD/HISTORY.md#v232--2022-09-13)

[Compare Source](JedWatson/classnames@v2.3.1...v2.3.2)

-   Fix TypeScript types when using require, thanks [Mark Dalgleish](https://github.com/markdalgleish) ([#&#8203;276](JedWatson/classnames#276))
-   Fix toString as `[Object object]` in a vm, thanks [Remco Haszing](https://github.com/remcohaszing) ([#&#8203;281](JedWatson/classnames#281))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xNDIuNSIsInVwZGF0ZWRJblZlciI6IjM4LjE0Mi41IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://gitea.bruyant.xyz/alexandre/PaletteSwitcher/pulls/48
Co-authored-by: Renovate <renovate@bruyant.xyz>
Co-committed-by: Renovate <renovate@bruyant.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants