-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimisations pour la carte GTFS nationale (#3122)
* Save exploratory notes * Build cachable global output * Try to create a materialized view (fails) * Find a hackish way to create materialized view * Use most relevant zoom level * Fix warnings * Add more zoom levels * Filter based on bounding box * Skip max/min queries + avoid attempt to create if already exists * Profile time taken * Add more zoom-levels after some testing around Paris & data refresh from production * Adjust max points without cluster (for Paris) * Move useful code to module * Optimize query by moving select into Postgres * Optimize the query by moving the JSON generation to the database (much faster) * Rename method for clarity, & document * Remove no-op step * Fix test * Use nice fragment trick to bring back the full structure * Replace todos and improve notes * Mix format * Fix credo warning
- Loading branch information
Showing
5 changed files
with
163 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
defmodule Transport.LogTimeTaken do | ||
@moduledoc """ | ||
Provides code to easily measure time taken by an operation | ||
all while returning the computed value | ||
""" | ||
defmacro __using__(_opts) do | ||
quote do | ||
require Logger | ||
end | ||
end | ||
|
||
require Logger | ||
|
||
def log_time_taken(message, cb) do | ||
{delay, result} = :timer.tc(cb) | ||
Logger.info("#{message} took #{delay / 1_000_000.0} seconds") | ||
result | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
defmodule TransportWeb.ExploreView do | ||
use TransportWeb, :view | ||
|
||
def render("gtfs_stops_data.json", conn) do | ||
conn.data | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters