Comments (12)
oops (forgot) - all those are in gravity-adv.sh file
from pi-hole.
I have only used awk for basic parsing, printing single columns, etc. Could you explain how your awk command works?
from pi-hole.
So I ran it using /run/shm instead of /tmp and it was about 2-3 seconds faster overall on my Pi. Using /dev/shm yielded similar results.
I would still like to understand your awk command in detail
from pi-hole.
Running in shm also reduce usage of SD card.
Now awk... well (g)awk is more complex tool then printing certain fields from lines (feel free to look up any tutorial).
In my example it does condition check (if (...) ) and
- check if first and second field is not starting with certain characters (# or / which can be comments)
- if line is not empty ($0 match whole line)
- if 2nd field not empty
there is logical and for each of those conditions, as when they all are true, it will print second field.
This should reduce need to use all those grep (and not sure why you need those sed in there?). I did not check how this will behave in case of white-space in beginning of line but that should not be a problem.
Reason to do so is to limit amount of sub-calls (and pipes) as each of it will take some time and CPU cycles to execute.
Also - side note (and quite separate thing): if you do checksum comparison of old and new file (i.e. md5sum of $eventHorizion and then same for /tmp/andLight.txt before mv) and trigger dnsmasq restart when files (checksums) are different, you can put this as cronjob (i.e. every day) so lists will be always up to date but dnsmasq will be restarted only when there was update.
from pi-hole.
Thanks for explaining it. It makes more sense now. I always knew awk was much more, but have never really utilized it. I love open source for this reason as I learned something and your skill will be able to make the code better and try things I never even thought about.
I will mess around with implementing this and see what I can come up with.
from pi-hole.
You are definitely right that it does not need the sort
on each line. I did some testing with it using the time
command and it seems a little faster only using it on the last line. In my brain, I was thinking it would be easier for the computer to sort a few sorted lists, but I guess the computer doesn't care (it's smarter than me)!
There is also a slight improvement in using RAM as opposed to the SD card, so that will make it in, too.
I'm still looking into your other suggestions.
from pi-hole.
Using my Mac as a test machine, the average time I can run the existing gravity-adv.sh script is 20-30 seconds. I will use that as the baseline for determining speed improvements.
from pi-hole.
I have made some significant improvements based on your suggestions. After some more testing to ensure it works, I will commit them.
from pi-hole.
Cool.
(was on longer holidays so did not reply before)
from pi-hole.
I am on vacation at the moment and will have to look at this in a couple of weeks.
from pi-hole.
I implemented your suggestions in another branch, that will be merged with the master soon.
from pi-hole.
Your suggestions were implemented in the release this evening.
from pi-hole.
Related Issues (20)
- FTL database shouldn't be readable by unprivileged users HOT 6
- Raspberry Pi 5 having trouble binding interfaces when using NetworkManager HOT 1
- Update of pi-hole not possible on Linuxmint 6 (Debian) HOT 2
- pihole -v shows update available but pihole -up doesn't HOT 6
- Default list author fine with breaking functionality -- suggest finding alternative HOT 4
- Dashboard hanging HOT 1
- Consider NOT rate-limiting queries from the local router HOT 4
- Update (pihole -up) fails as installer (basic-install.sh) bypasses local DoH proxy HOT 3
- DHCP static reservation will not reset when changed. HOT 1
- v6: documentation on PUT /clients/ is not complete HOT 3
- Pihole stop working at all after reboot. Can't access internet by itself HOT 3
- pihole -up Banana Pi M1 not working HOT 2
- OS Detection saying supported OS is not Supported HOT 9
- "Restart DNS resolver" required every few days to make browsing work again! HOT 42
- crash on internet outage HOT 2
- fails to install in nobara linux(fedora 39) HOT 7
- wasabisys.com always gets N/A reply; perhaps due to absurd reply that canβt be handled? HOT 1
- Using "IP/admin" page for admin interface returns a blank/clear/white page. HOT 1
- Logfiles under /etc/pihole HOT 1
- Teleporter does not restore DHCP server enabled state
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pi-hole.