Skip to content

Commit

Permalink
Merge pull request #9 from carvilsi/develop
Browse files Browse the repository at this point in the history
adding CONTRIBUTING.md
  • Loading branch information
carvilsi authored Mar 20, 2024
2 parents d9b08f9 + e05309d commit 2368853
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 11 deletions.
54 changes: 54 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# CONTRIBUTING

Contributions are very welcome! :pray:

Fork the repo, do your things and create a pull request to **develop** branch. And check that all the tests are green :)

## Adding new faces

If you want to add a new face, the place to do it is at the **customs** javascript object at **src/faces.js** under the **custom** property.
Inside the **custom** property you can create another property, e.g. if you want to have a bundle of faces under the same description.
Also do not repeat any name, but the linter will show this issue.

e.g.

```javascript
const customs = {
custom: {
cthulhu: [ '^(;,;)^' ],
facepalm: [ '(P,\')', '(p,\')' ],
horns_heavy: [ '\\m/,' ],
question: [ '(p_-)', '(-_q)' ],
star: [ '' ],
my_awesome_new_text_faces: {
thinking_something: [ '^?' ],
spiral_child: [ '^@' ]
}
}
};
```

or just:

```javascript
const customs = {
custom: {
cthulhu: [ '^(;,;)^' ],
facepalm: [ '(P,\')', '(p,\')' ],
horns_heavy: [ '\\m/,' ],
question: [ '(p_-)', '(-_q)' ],
star: [ '' ],
thinking_something: [ '^?' ],
spiral_child: [ '^@' ]
}
};
```

The reason to add the new faces at **customs** object is to maintain the wikipedia's faces as is right now at the **canonical** object.

After adding a new faces, please update the number of faces at tests on [TOTAL_FACES](https://github.com/carvilsi/facetxt/blob/d9b08f9d4b3b23446c5fd78f3293501861a15016/tests/main.test.js#L6) constant.

## Adding or updating a functionality

Please open an issue with your idea and we'll discuss together ;)

22 changes: 11 additions & 11 deletions benchmark/report.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
┌─────────┬──────────────────────────────────────┬──────────────┬───────────────────┬──────────┬─────────┐
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │
├─────────┼──────────────────────────────────────┼──────────────┼───────────────────┼──────────┼─────────┤
│ 0 │ 'random face' │ '1,746,694' │ 572.5099330168117 │ '±2.30%' │ 174670
│ 1 │ 'random face with description' │ '1,149,262' │ 870.123600198419 │ '±2.01%' │ 114927
│ 2 │ 'get array with all the faces' │ '9,731' │ 102758.81724845833 │ '±1.28%' │ 974
│ 3 │ 'get all the faces for pretty print' │ '11,510,433' │ 86.8777023294174 │ '±1.11%' │ 1151044
│ 4 │ 'get one by name; more than one' │ '25,434' │ 39316.516902512136 │ '±1.03%' │ 2544
│ 5 │ 'get one by name; just one' │ '26,198' │ 38170.156106875525 │ '±1.12%' │ 2620
│ 6 │ 'get array of faces by name' │ '25,849' │ 38685.08007737328 │ '±1.06%' │ 2585
└─────────┴──────────────────────────────────────┴──────────────┴───────────────────┴──────────┴─────────┘
┌─────────┬──────────────────────────────────────┬──────────────┬───────────────────┬──────────┬─────────┐
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │
├─────────┼──────────────────────────────────────┼──────────────┼───────────────────┼──────────┼─────────┤
│ 0 │ 'random face' │ '884,214' │ 1130.947659242501 │ '±9.16%' │ 88497
│ 1 │ 'random face with description' │ '1,170,516' │ 854.3239073231738 │ '±2.12%' │ 117052
│ 2 │ 'get array with all the faces' │ '8,995' │ 111169.4766666642 │ '±1.66%' │ 900
│ 3 │ 'get all the faces for pretty print' │ '11,540,558' │ 86.65091988613777 │ '±0.34%' │ 1154056
│ 4 │ 'get one by name; more than one' │ '20,015' │ 49960.50449551036 │ '±2.01%' │ 2002
│ 5 │ 'get one by name; just one' │ '13,818' │ 72366.4204052115 │ '±2.70%' │ 1382
│ 6 │ 'get array of faces by name' │ '18,619' │ 53707.17991407953 │ '±3.89%' │ 1862
└─────────┴──────────────────────────────────────┴──────────────┴───────────────────┴──────────┴─────────┘

0 comments on commit 2368853

Please sign in to comment.