Skip to content

Commit

Permalink
chore(es-bench): improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed Apr 15, 2023
1 parent 1a4e4e0 commit fddf826
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions demo/es-bench/date-locale.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
import {bench} from './bench.js';

// 18,303,355/s with 44,597.25kb
bench('date-now', () => {
bench('date_now', () => {
Date.now();
});

// 12,177,203/s with 51,511.3kb
bench('new-date', () => {
bench('new_date', () => {
new Date();
});

// 677,056/s with 52,559.87kb
const dateTimeFormat = Intl.DateTimeFormat('fa');
bench('date-time-format-new', () => {
bench('date_time_format_new', () => {
dateTimeFormat.format(new Date());
});

// 9,770/s with 2,381,545.47kb
bench('new-date-time-format-new', () => {
bench('new_date_time_format_new', () => {
const dateTimeFormat = Intl.DateTimeFormat('fa');
dateTimeFormat.format(new Date());
});

// 766,025/s with 2,227,060.74kb
bench('date-time-format-now', () => {
bench('date_time_format_now', () => {
dateTimeFormat.format(Date.now());
});

// 9,616/s with 1,784,446.98kb
bench('new-date-time-format-now', () => {
bench('new_date_time_format_now', () => {
const dateTimeFormat = Intl.DateTimeFormat('fa');
dateTimeFormat.format(Date.now());
});

// 757,297/s with 1,626,062.85kb
bench('to-locale-date-string', () => {
bench('to_locale_date_string', () => {
const time = Date.now();
new Date(time).toLocaleDateString('fa');
});

globalThis.document?.body.append(' Done. Check the console.');

0 comments on commit fddf826

Please sign in to comment.