Skip to content

Commit 321a003

Browse files
committed
Weather info + benchmark
1 parent 70235fe commit 321a003

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

README.md

+32-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pls (short for please) is a console-based to-do list, that greets you with the weather, an inspirational quote, and any tasks you must complete. It is inspired by [please](https://github.com/NayamAmarshe/please), which is written in Python.
44

5-
![](images/2022-07-04_14-34.png)
5+
![](images/setup.png)
66
# Installation
77

88
You can install `pls` by running:
@@ -38,4 +38,34 @@ pls list
3838
pls ls
3939
```
4040
[![asciicast](https://asciinema.org/a/tq38FG5yP6AIZGymjc4LCe2jF.svg)](https://asciinema.org/a/tq38FG5yP6AIZGymjc4LCe2jF)
41-
![](images/2022-07-04_14-32.png)
41+
![](images/2022-07-04_14-32.png)
42+
43+
# Weather information
44+
Upon first launch you will be asked your name (for a greeting). Then you will be asked if you want to query for the weather data for your location.
45+
The weather is retrieved from [wttr.in](https://github.com/chubin/wttr.in) and by default it will geolocate your location automatically.
46+
To see what that looks like, click here: https://wttr.in/?format=%l:+%C+%c+%t
47+
Alternatively, if the geolocation is not accurate, you can manually specify a city. For example, if you live in New York, visit https://wttr.in/new-york and verify that the coordinates are correct (some smaller cities may not exist in wttr.in's database). If the coordinates are correct, answer yes to "Would you like to save a more specific location (your exact city)?".
48+
49+
---
50+
The weather is cached for one hour by default. After the cached weather data is expired, if you launch pls, by default it will *not* block the process to load the weather (unless -r is specified). It launches a background process to load the weather data and save it for the next time it is launched. This is to avoid ever having a bottleneck with the terminal never loading a shell because the internet is down, for example. This means if you launch the terminal rarely, the weather data may be out of date. If you want to force it to block on loading the weather data, launch pls with the -r/--refresh flag set.
51+
52+
# Benchmark
53+
54+
`pls` is significantly faster than `please` (one might even say blazingly fast).
55+
56+
Benchmark 1: pls
57+
Time (mean ± σ): 3.1 ms ± 1.2 ms [User: 1.3 ms, System: 1.8 ms]
58+
Range (min … max): 0.4 ms … 10.1 ms 5000 runs
59+
60+
Warning: Command took less than 5 ms to complete. Results might be inaccurate.
61+
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
62+
63+
Benchmark 2: please
64+
Time (mean ± σ): 134.5 ms ± 9.9 ms [User: 121.1 ms, System: 12.7 ms]
65+
Range (min … max): 128.7 ms … 187.5 ms 5000 runs
66+
67+
Summary
68+
'pls' ran
69+
43.51 ± 17.30 times faster than 'please'
70+
71+
In summary, pls takes roughly 3ms to launch, and please takes roughly 134ms (unfortunately a noticeable delay).

images/setup.png

39.4 KB
Loading

0 commit comments

Comments
 (0)