How could I improve the performance of my radiocarbon calibration library?

I wrote a small library + executable for radiocarbon calibration: https://github.com/nevrome/currycarbon

There are plenty of software tools out there to do this, but afaik no Haskell library. So far this has been a didactically very valuable project, but now I hit a roadblock. My code appears to be embarrassingly slow compared to other tools, and I don't understand why. Maybe you have a moment to comment on that - or any other aspect of the project.

On my system currycarbon takes almost four seconds to calibrate a sequence of dates ("1000,200;2000,200;3000,200;4000,200;5000,200;6000,200;7000,200;8000,200"), whereas a similar tool written in C++ (https://github.com/ISAAKiel/calibrator) takes less than 0.2 seconds. There are some algorithmic differences, and indeed there are multiple ways to implement radiocarbon calibration in general, but I think it must be possible to implement the algorithm I selected in a fast way.

Profiling currycarbon gives me the following output:

    currycarbon +RTS -N -p -RTS 1000,200;2000,200;3000,200;4000,200;5000,200;6000,200;7000,200;8000,200 -q --densityFile /dev/null

  total time  =        9.39 secs   (29246 ticks @ 1000 us, 16 processors)
  total alloc = 33,991,769,624 bytes  (excludes profiling overheads)

COST CENTRE                                    MODULE                            SRC                                                    %time %alloc

>>=                                            Data.Vector.Fusion.Util           Data/Vector/Fusion/Util.hs:36:3-18                      34.1   42.6
projectUncalOverCalCurve.vectorMatrixMultSum.\ Currycarbon.Calibration           src/Currycarbon/Calibration.hs:148:62-90                17.3   16.4
makeCalCurveMatrix.buildMatrix.\               Currycarbon.Calibration           src/Currycarbon/Calibration.hs:94:59-87                 14.8   13.0
basicUnsafeIndexM                              Data.Vector.Primitive             Data/Vector/Primitive.hs:245:3-75                        8.9   10.4
fmap                                           Data.Vector.Fusion.Stream.Monadic Data/Vector/Fusion/Stream/Monadic.hs:(134,3)-(136,20)    5.4    7.0
basicUnsafeWrite                               Data.Vector.Primitive.Mutable     Data/Vector/Primitive/Mutable.hs:131:3-69                5.0    4.4
basicUnsafeIndexM                              Data.Vector.Unboxed.Base          Data/Vector/Unboxed/Base.hs:304:833-890                  4.1
... keep reading on reddit ➑

πŸ‘︎ 20
πŸ’¬︎
πŸ‘€︎ u/nevrome
πŸ“…︎ Sep 05 2021
🚨︎ report
Fine-tuning radiocarbon dating could 'rewrite' ancient events - Study questions the accuracy of a single calibration curve for all of the Northern Hemisphere. eurekalert.org/pub_releas…
πŸ‘︎ 114
πŸ’¬︎
πŸ‘€︎ u/anutensil
πŸ“…︎ Mar 19 2020
🚨︎ report
A new calibration curve will extend radiocarbon calibration & improve earlier parts of the curve "...up to 50,000 years before today." sciencedaily.com/releases…
πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/anutensil
πŸ“…︎ Feb 12 2010
🚨︎ report
New calibration curve extends radiocarbon dating back to 50,000 years BP. sciencedaily.com/releases…
πŸ‘︎ 11
πŸ’¬︎
πŸ‘€︎ u/anthropology_nerd
πŸ“…︎ Feb 12 2010
🚨︎ report
Researchers have developed a new radiocarbon calibration curve that will allow key past events to be dated more accurately sheffield.ac.uk/news/nr/n…
πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/lonelyinacrowd
πŸ“…︎ Dec 03 2013
🚨︎ report
How and why is a RadioCarbon (14C) date calibrated?

I am looking at several AMS 14C dates and cannot for the life of me understand why they are being used uncalibrated in the literature or why calibrating a date is necessary.

A date of 8030 Β± 160 turns into 6974 Β± 233 after calibration (CalPal)

What is the process behind calibration? Which is the more correct number? Thanks everyone.

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/GingerMe
πŸ“…︎ Apr 03 2014
🚨︎ report
Can someone explain the difference between calibrated and uncalibrated radiocarbon dating?

What sort of difference in dating results? Why is uncalibrated dating still used?

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/purplepistachio
πŸ“…︎ Feb 25 2014
🚨︎ report
How do I understand Radiocarbon dating results?

I received these results for a Christmas present I purchased, but how do I understand them, or can anyone tell me the age range of this piece of wood? I would really appreciate it.

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Thats_not_ideal
πŸ“…︎ Dec 22 2021
🚨︎ report
Hey I’m new to this.

I recently was listening to one of the Randall Carlson podcasts on rogan and I wound up not making it very far because I honestly thought it sounded a little coocoo.

Well decided to give it another shot, this time watching it… and omfg. I listened to all of them back to back. And also the graham hancock ones. I could not put any of this stuff down. It blows my mind that there are LEGIT theories like this that are not being investigated by the main stream. Everything, including history, should have the right to be challenged.

My mind feels legit blown. Maybe I’m a little naive. I’m not an archeologist or a geologist. But damn… I really wish we knew ourselves.

πŸ‘︎ 52
πŸ’¬︎
πŸ‘€︎ u/skynet_666
πŸ“…︎ Nov 11 2021
🚨︎ report
When in doubt, quote-mine: CMI's latest insult to the intelligence of its readers

GΓΆbekli Tepe is a monumental Neolithic site which sets creationists before their perennial conundrum of how to explain stuff being 14C-dated considerably older than their date of creation (in this case over 3000 years older).

Long story short, they can't and we've been through this many times. But today's CMI article is quite interesting, because in addition to all usual hand-wavey rationalisations ("the flood magically messed 14C up!") it contains a number of quote-mines (of this paper, from p36, on the radiodating of the site) which I don't think anyone could reasonably argue are honest mistakes. But I'll leave that to the reader to judge.

 

Quote-mine number 1

>each of the three stratigraphic sequences [at GΓΆbekli Tepe] had their own dating challenges. For instance, layer III was backfilled at the end of its use such that it:

>β€œ … poses severe problems for the dating of this layer using the radiocarbon method, as organic remains from the fill-sediments could be older or younger than the enclosures, with younger samples becoming deposited at lower depths, thus producing an inverse stratigraphy.”

This is absolutely correct. If you use organic remains from the fill to date layer III, you may not get an accurate date. Two paragraphs on they describe how this problem can be avoided by dating plaster from the wall instead.

Obviously, CMI must have intended to quote this bit too, as nobody would quote a problem without quoting the straightforward solution, right? I can only assume some tragic copy-pasting error must have occurred here.

 

Quote-mine number 2

>It was found that carbon dates for layer II were inconsistent with the chronology of layer III so that:

>β€œ … the data fail to provide absolute chronological points of reference for architecture and strata.”

This part of the paper is about 14C dating of carbonates that formed on the walls after they were buried. Because this layer forms over a long period of time, it can only give a minimum date for the age of the wall: however, it still accurately establishes the relative chronology of layer II and layer III, and dates both of them to at least the 7th millennium BCE.

Mightn't CMI's audience want to know that the uncertainty here is in exactly the wrong direction, and

... keep reading on reddit ➑

πŸ‘︎ 35
πŸ’¬︎
πŸ‘€︎ u/ThurneysenHavets
πŸ“…︎ Dec 23 2021
🚨︎ report
New dates for the start of Viking-age trade - JONO Art jonoart.com/new-dates-for…
πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/gus_jock
πŸ“…︎ Dec 22 2021
🚨︎ report
In Madrid, a 76,000-year-old Neanderthal hunting camp was discovered ancient-archeology.com/in…
πŸ‘︎ 61
πŸ’¬︎
πŸ‘€︎ u/DifficultAd7382
πŸ“…︎ Aug 31 2021
🚨︎ report
When Scientific Orthodoxy Resembles Religious Dogma: Those who refuse to consider an unconventional idea in science are disturbingly similar to those who refused to look through Galileo’s telescope. scientificamerican.com/ar…
πŸ‘︎ 290
πŸ’¬︎
πŸ“…︎ May 24 2021
🚨︎ report
Questions on a bizarre revision of Roman chronology based on dendrochronology

Recently I fell into a deep rabbit hole of ResearchGate papers by Lars Ake Larsson and Petra Ossowski Larson, these two try to argue that Western Roman chronology should be moved 200+ years because trees from 200-300 ADs match trees from 400-500 ADs and because their "new calibration dates" that conveniently support all of their preconceived ideas. They also do all sorts of bizarre historical revisionism, like arguing that Justinian I coexisted with Constantine (or maybe that they were the same person), that most Western Roman emperors coexisted with Eastern ones (examples: Gordian III and Leo I existed at the same time, there is much more) or that Jesus and his disciples lived around 200 AD, and so did Augustine, Pilate and others. Can anyone comment on their conclusions? Especially those about dendrochronology? Thanks.

πŸ‘︎ 18
πŸ’¬︎
πŸ“…︎ Sep 25 2021
🚨︎ report
SERIOUS: This subreddit needs to understand what a "dad joke" really means.

I don't want to step on anybody's toes here, but the amount of non-dad jokes here in this subreddit really annoys me. First of all, dad jokes CAN be NSFW, it clearly says so in the sub rules. Secondly, it doesn't automatically make it a dad joke if it's from a conversation between you and your child. Most importantly, the jokes that your CHILDREN tell YOU are not dad jokes. The point of a dad joke is that it's so cheesy only a dad who's trying to be funny would make such a joke. That's it. They are stupid plays on words, lame puns and so on. There has to be a clever pun or wordplay for it to be considered a dad joke.

Again, to all the fellow dads, I apologise if I'm sounding too harsh. But I just needed to get it off my chest.

πŸ‘︎ 17k
πŸ’¬︎
πŸ‘€︎ u/anywhereiroa
πŸ“…︎ Jan 15 2022
🚨︎ report
Why carbon-14 dating is inaccurate and even calibration cannot help

In this article, I’m going to present the difficulties with carbon-14 dating of manuscripts, in which calibration will make it more precise, but not to the exact decades.

There is a great amount of carbon-12 and carbon-13 isotopes in the atmosphere, where carbon-12 is the most stable one and accounts for around 99% of the amount, and carbon-13 accounts for around 1%. Then there is carbon-14 which is produced by cosmic rays.

How carbon-14 isΒ formed

In the atmosphere nitrogen-14 is converted into carbon-14 caused by cosmic rays, in which it reacts with oxygen, creating carbonmonooxid, and then reacting again, creating CO2. The amount in the atmosphere is very low, around 0.000000000001%, compared to carbon-12 and carbon-13.

How is carbon-14 used in radiometric dating?

Since carbon-12 is stable, and the half-life of carbon-14 is 5730 -+40 years, the ratio of these two is used to date samples. For this a reference is needed, that is the equilibrium of carbon-12 and carbon-14 in the atmosphere. Since it is not constant, it can be easily calculated. However since the equilibrium shifts also, tree rings are used to calibrate it more precise

How tree rings makes carbon-14 calibration precise

Due to industrialization and many different factors, like volcanoes, solar events, and others during Earth’s history, it changes the amount and concentration of carbon-12 and carbon-14, which makes carbon-14 dating not reliable. To account for this, a calibration tool is used, by using tree rings. For every year a new ring is formed in a tree, and by counting the tree rings, for example in a 400 year old tree, which has 400 tree rings, they radiometric date every tree ring, which corresponds to a yearβ€Šβ€”β€Šand then it can account for many different deviations. By using tree rings, one can exactly know when a spark in carbon-14 happened, like the spark in 774–775 AD, or the spark in around 660 AD, or know when other natural disasters happened during the last thousands of years.

Still not accurate with calibration

By using tree rings and carbon-14, one can directly know the exact year and its ratio of carbon-12 and carbon-14 that year, but the reverse is not true. You cannot know if a manuscript was written in 658 AD or in 660 AD, which means one cannot know if the manuscript was impacted by the spark in 660 AD or not. Or of course also by a drop o

... keep reading on reddit ➑

πŸ‘︎ 17
πŸ’¬︎
πŸ‘€︎ u/EdgarMorina
πŸ“…︎ Jun 16 2021
🚨︎ report
Detailed Analysis of the Coconut Fibre Documents presented on the Oak Island Treasure Website

Coconut Files Analysis

Introduction

This report provides an analysis of the documents as provided on oakislandtreasure.co.uk in August 2021 that are stated to support the claim that coconut fibre was found on Oak Island. The purpose of this report is to interrogate the documents to determine if they provide enough evidence to definitively prove that a massive layer of coconut fibre was present just under the beach in Smith’s Cove prior to 1795. The documents are presented here in order from oldest to newest, largely in reverse order to as they are presented on the webpage.

1) Filename: Letter to R.V.Harris

Date: 22 July 1937

From: Hugh P. Bell, Head, Dept of Biology, Dalhousie University

To: Reginald V Harris Esq

Outcome:

Β· Was not prepared to make a definitive statement.

Β· Sample was suspected to be β€œour common eel grass (Zostera marina)”

Β· Suggested sending the sample to the Bureau of Plant Industries Washington for further analysis.

2) Filename: img073Letter to R.V.Harris

Date: 10 August 1937

From: C. O. Erlanson, Ecologist, United States Department of Agriculture, Bureau of Plant Industry

To: Reginald V. Harris, K.C.

Outcome:

Β· The fibrous material was examined by various experts.

Β· None could identify it.

Β· β€œIt is unquestionably the fibro-vascular bundle tissue of some plant.”

My Observations:

Β· He mentions that the fibrous material was found on the shore of Oak Island. As the sample was sent by R.V. Harris, this information is relying on the sender’s description of the location of the find.

3) Filename: Letter to R.V.Harris

Date: 22 October 1937

From: Albert F. Hill, Research Assistant, Botanical Museum of Harvard University

To: Reginald V. Harris, K.C.

Outcome:

Β· β€œMaterial has suffered somewhat from its burial in the ground”.

Β· β€œit is readily distinguishable as Manila hemp.”

Β· β€œtypical Manila hemp fibers are to be noted in a microscopic examination of macerated material”

Β· He surmises that the material β€œrepresents the partly disintegrated remains of some ship’s cables or hawsers.”

My Observations:

Β· He mentions that the item was a β€œdeposit on the shores of Oak Island”. As the sample was sent by R.V. Harris, this information is relying on the sender’s description of the location of the find.

Β· Manila Hemp is not coconut fibre.

4) Filename: Letter from R.V.Harris to Gilbert D.Hedden

Date: 26 October 1937

From: Assumed to be R.V. Harris, the signature block is cut off.

To: Gilb

... keep reading on reddit ➑

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/Rdick_Lvagina
πŸ“…︎ Aug 17 2021
🚨︎ report
Blind Girl Here. Give Me Your Best Blind Jokes!

Do your worst!

πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Leckzsluthor
πŸ“…︎ Jan 02 2022
🚨︎ report
This subreddit is 10 years old now.

I'm surprised it hasn't decade.

πŸ‘︎ 14k
πŸ’¬︎
πŸ‘€︎ u/frexyincdude
πŸ“…︎ Jan 14 2022
🚨︎ report
Dropped my best ever dad joke & no one was around to hear it

For context I'm a Refuse Driver (Garbage man) & today I was on food waste. After I'd tipped I was checking the wagon for any defects when I spotted a lone pea balanced on the lifts.

I said "hey look, an escaPEA"

No one near me but it didn't half make me laugh for a good hour or so!

Edit: I can't believe how much this has blown up. Thank you everyone I've had a blast reading through the replies πŸ˜‚

πŸ‘︎ 20k
πŸ’¬︎
πŸ‘€︎ u/Vegetable-Acadia
πŸ“…︎ Jan 11 2022
🚨︎ report
What starts with a W and ends with a T

It really does, I swear!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/PsychedeIic_Sheep
πŸ“…︎ Jan 13 2022
🚨︎ report
Why did Karen press Ctrl+Shift+Delete?

Because she wanted to see the task manager.

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Eoussama
πŸ“…︎ Jan 17 2022
🚨︎ report
So 2 trees got arrested in the town I live...

Heard they've been doing some shady business.

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/K1ll47h3K1n9
πŸ“…︎ Jan 18 2022
🚨︎ report
What is the scariest tree?

BamBOO!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/K1ll47h3K1n9
πŸ“…︎ Jan 18 2022
🚨︎ report
What is a a bisexual person doing when they’re not dating anybody?

They’re on standbi

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Toby-the-Cactus
πŸ“…︎ Jan 12 2022
🚨︎ report
Geddit? No? Only me?
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/shampy311
πŸ“…︎ Dec 28 2021
🚨︎ report
I wanna hear your best airplane puns.

Pilot on me!!

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/Paulie_Felice
πŸ“…︎ Jan 07 2022
🚨︎ report
E or ß?
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Amazekam
πŸ“…︎ Jan 03 2022
🚨︎ report
Which actor drives the least?

Christopher Walken

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/TR1771N
πŸ“…︎ Jan 18 2022
🚨︎ report
What did Spartacus say when the lion ate his wife?

Nothing, he was gladiator.

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/rj104
πŸ“…︎ Jan 15 2022
🚨︎ report
Pun intended.
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Sharmaji1301
πŸ“…︎ Jan 15 2022
🚨︎ report
No spoilers
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Onfour
πŸ“…︎ Jan 06 2022
🚨︎ report
Covid problems
πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/theincrediblebou
πŸ“…︎ Jan 12 2022
🚨︎ report
These aren't dad jokes...

Dad jokes are supposed to be jokes you can tell a kid and they will understand it and find it funny.

This sub is mostly just NSFW puns now.

If it needs a NSFW tag it's not a dad joke. There should just be a NSFW puns subreddit for that.

Edit* I'm not replying any longer and turning off notifications but to all those that say "no one cares", there sure are a lot of you arguing about it. Maybe I'm wrong but you people don't need to be rude about it. If you really don't care, don't comment.

πŸ‘︎ 12k
πŸ’¬︎
πŸ‘€︎ u/Lance986
πŸ“…︎ Dec 15 2021
🚨︎ report
Should we create an English word for the 'day after tomorrow'?

Or would that be too forward thinking?

πŸ‘︎ 2k
πŸ’¬︎
πŸ‘€︎ u/afunkysquirrel
πŸ“…︎ Jan 19 2022
🚨︎ report
Spi__
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/Fast_Echidna_8520
πŸ“…︎ Jan 11 2022
🚨︎ report
What did 0 say to 8 ?

What did 0 say to 8 ?

" Nice Belt "

So What did 3 say to 8 ?

" Hey, you two stop making out "

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/designjeevan
πŸ“…︎ Jan 03 2022
🚨︎ report
I had a vasectomy because I didn’t want any kids.

When I got home, they were still there.

πŸ‘︎ 10k
πŸ’¬︎
πŸ‘€︎ u/demotrek
πŸ“…︎ Jan 13 2022
🚨︎ report
I dislike karma whores who make posts that imply it's their cake day, simply for upvotes.

I won't be doing that today!

πŸ‘︎ 15k
πŸ’¬︎
πŸ‘€︎ u/djcarves
πŸ“…︎ Dec 27 2021
🚨︎ report
For Gotham
πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/FreeHugsXD
πŸ“…︎ Jan 17 2022
🚨︎ report
The Ancient Romans II
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/mordrathe
πŸ“…︎ Dec 29 2021
🚨︎ report
I'd like to dedicate this joke to my wisdom teeth.

[Removed]

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/ThoughtPumP
πŸ“…︎ Jan 14 2022
🚨︎ report
Where do you find a cow with no legs?

Where ever you left it πŸ€·β€β™€οΈπŸ€­

πŸ‘︎ 4k
πŸ’¬︎
πŸ‘€︎ u/kitkatty0309
πŸ“…︎ Jan 16 2022
🚨︎ report
I did it, I finally did it. After 4 years and 92 days I went from being a father, to a dad.

This morning, my 4 year old daughter.

Daughter: I'm hungry

Me: nerves building, smile widening

Me: Hi hungry, I'm dad.

She had no idea what was going on but I finally did it.

Thank you all for listening.

πŸ‘︎ 17k
πŸ’¬︎
πŸ‘€︎ u/Sk2ec
πŸ“…︎ Jan 01 2022
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.