Julia simple String process and file I/O is slow

I was doing i/o in julia from string. Code as follows

function func(strd)
    a = Any[];
    for url in split(replace(strd, "\n" => ""), "โœ–")
        if occursin(".",url)
            push!(a, url);
        end
    end
    trackers = open("trackers.txt", "w");
    for url in a
        write(trackers, url*"\n");
    end
    close(trackers);
    print("Successfully completed\n");
end


@time func(bigstring);

Which gave this speed running 4 times

  0.002172 seconds (8.27 k allocations: 351.641 KiB)
  0.002462 seconds (8.27 k allocations: 351.641 KiB)
  0.001033 seconds (8.27 k allocations: 351.641 KiB)
  0.002265 seconds (8.27 k allocations: 351.641 KiB)

and I have same style Python function as

def main(strd):
    a= []
    for url in strd.replace("\n", "").split("โœ–"):
        if "." in url:
            a.append(url)
    trackers = open("trackers2.txt", "w")

    for url in a:
        trackers.write(url+"\n")
    trackers.close()
    print("Successfully completed\n")

import time
start_time = time.time()
main(bigstring)
print("--- {} seconds ---".format((time.time() - start_time)))

which gave this speed running 4 times

--- 0.0009250640869140625 seconds ---
--- 0.0007033348083496094 seconds ---
--- 0.0007412433624267578 seconds ---
--- 0.0006651878356933594 seconds ---

Iโ€™ve tested it on separate file with same bigstring which is huge string of trackers.

Summary
bigstring = """

1dmp.io

โœ–

1rx.io

โœ–

sync.1rx.io

โœ–

247-inc.net

โœ–

2o7.net

โœ–

112.2o7.net

โœ–

122.2o7.net

โœ–

33across.com

โœ–

ssc-cms.33across.com

โœ–

360.cn

โœ–

360yield.com

โœ–

3conline.com

โœ–

3gl.net

โœ–

3lift.com

โœ–

eb2.3lift.com

โœ–

4dex.io

โœ–

50bang.org

โœ–

51.la

โœ–

6sc.co

โœ–

a-mo.net

โœ–

aamsitecertifier.com

โœ–

aasaam.com

โœ–

aaxads.com

โœ–

c.aaxads.com

โœ–

acpm.fr

โœ–

acstat.com

โœ–

activehosted.com

โœ–

acuityplatform.com

โœ–

ad-score.com

โœ–

ad-stir.com

โœ–

ad.gt

โœ–

a.ad.gt

โœ–

seg.ad.gt

โœ–

adalyser.com

โœ–

addthis.com

โœ–

s7.addthis.com

โœ–

adentifi.com

โœ–

adform.net

โœ–

adfox.ru

โœ–

adhaven.com

โœ–

adhigh.net

โœ–

adition.com

โœ–

imagesrv.adition.com

โœ–

adkernel.com

โœ–

sync.adkernel.com

โœ–

admedo.com

โœ–

pj.l.admedo.com

โœ–

admicro.vn

โœ–

admixer.net

โœ–

adnxs.com

โœ–

ib.adnxs.com

โœ–

adobe.com

โœ–

auth.adobe.com

โœ–

wwwimages.adobe.com

โœ–

xsdownload.adobe.com

โœ–

adocean.pl

โœ–

adop.cc

โœ–

adpushup.com

โœ–

cdn.adpushup.com

โœ–

adriver.ru

โœ–

adroll.com

โœ–

adscale.de

โœ–

adskeeper.co.uk

โœ–

adskeeper.com

โœ–

adspsp.com

โœ–

adsrvr.org

โœ–

match.adsrvr.org

โœ–

adswizz.com

โœ–

adsymptotic.com

โœ–

adtelligent.com

โœ–

adtimaserver.vn

โœ–

adtng.com

โœ–

advangelists.com

โœ–

advertising.com

โœ–

pixel.advertising.com

โœ–

advividnetwork.com

โœ–

adzerk.net

โœ–

affirm.com

โœ–

agkn.com

โœ–

aidata.io

โœ–

aimediagroup.com

โœ–

aiproxies.com

โœ–

airpr.com

โœ–

ajax.googleapis.com

โœ–

akamaihd.net

โœ–

akamaized.net

โœ–

albacross.com

โœ–

alexametrics.com

โœ–

certify-js.alexametrics.com

โœ–

alfasense.com

โœ–

alibaba.com

โœ–

alicdn.com

โœ–

amap.com

โœ–

amazon-adsystem.com

โœ–

c.amazon-adsystem.com

โœ–

amazon.com

โœ–

amcdn.vn

โœ–

analytics-egain.com

โœ–

analytics-sm.com

โœ–

aniview.com

โœ–

anquan.org

โœ–

anvato.net

โœ–

tkx-acc.apis.anvato.net

โœ–

cdn.anvato.net

โœ–

mcp-media5.anvato.net

โœ–

tkx2-prod.anvato.net

โœ–

aparat.com

โœ–

app-us1.com

โœ–

app.link

โœ–

apparmor.com

โœ–

appconsent.io

โœ–

appdynamics.com

โœ–

appier.net

โœ–

apple.com

โœ–

appsflyer.com

โœ–

apvdr.com

โœ–

aralego.com

โœ–

asadcdn.com

โœ–

asapp.com

โœ–

aso1.net

โœ–

associates-amazon.com

โœ–

z-na.associates-amazon.com

โœ–

atdmt.com

โœ–

atgsvcs.com

โœ–

ati-host.net

โœ–

attentivemobile.com

โœ–

attn.tv

โœ–

autopilothq.com

โœ–

avantisvideo.com

โœ–

cdn.avantisvideo.com

โœ–

avct.cloud

โœ–

avmws.com

โœ–

avocet.io

โœ–

azureedge.net

โœ–

b0e8.com

โœ–

b1img.com

โœ–

bablic.com

โœ–

baidu.com

โœ–

hiphotos.baidu.com

โœ–

imgsa.baidu.com

โœ–

imgsrc.baidu.com

โœ–

api.map.baidu.com

โœ–

sapi.map.baidu.com

โœ–

bam-x.com

โœ–

baynote.net

โœ–

bazaarvoice.com

โœ–

bdg-analytics.appspot.com

โœ–

betgorebysson.club

โœ–

betweendigital.com

โœ–

bfmio.com

โœ–

sync.bfmio.com

โœ–

bidr.io

โœ–

bidswitch.net

โœ–

x.bidswitch.net

โœ–

bigmining.com

โœ–

bing.com

โœ–

bat.bing.com

โœ–

c.bing.com

โœ–

www.bing.com

โœ–

bitrix.info

โœ–

bizible.com

โœ–

bizibly.com

โœ–

bizographics.com

โœ–

bizrate.com

โœ–

bluecava.com

โœ–

blueconic.net

โœ–

cdn.blueconic.net

โœ–

bluekai.com

โœ–

boldchat.com

โœ–

bounceexchange.com

โœ–

assets.bounceexchange.com

โœ–

boxx.ai

โœ–

brightcove.com

โœ–

broadstreetads.com

โœ–

brsrvr.com

โœ–

bttrack.com

โœ–

btttag.com

โœ–

buzzoola.com

โœ–

c212.net

โœ–

c3tag.com

โœ–

capturehighered.net

โœ–

casalemedia.com

โœ–

as-sec.casalemedia.com

โœ–

ssum-sec.casalemedia.com

โœ–

castle.io

โœ–

cctv.com

โœ–

cdn-net.com

โœ–

cdnwidget.com

โœ–

chartbeat.net

โœ–

ping.chartbeat.net

โœ–

cheqzone.com

โœ–

choozle.com

โœ–

cintnetworks.com

โœ–

clarity.ms

โœ–

clearbit.com

โœ–

clevernt.com

โœ–

clickondetroit.com

โœ–

www.clickondetroit.com

โœ–

clicktale.net

โœ–

cdnssl.clicktale.net

โœ–

clicktripz.com

โœ–

clinch.co

โœ–

clive.cloud

โœ–

clmbtech.com

โœ–

cloudflare.com

โœ–

cnzz.com

โœ–

cohesionapps.com

โœ–

cdn.cohesionapps.com

โœ–

collectandgather.com

โœ–

colossusssp.com

โœ–

commander1.com

โœ–

company-target.com

โœ–

condenastdigital.com

โœ–

connatix.com

โœ–

connectad.io

โœ–

connextra.com

โœ–

contentexchange.me

โœ–

contentsfeed.com

โœ–

contentsquare.net

โœ–

contextweb.com

โœ–

bh.contextweb.com

โœ–

coremetrics.com

โœ–

coub.com

โœ–

cpmstar.com

โœ–

cpx.to

โœ–

p.cpx.to

โœ–

cquotient.com

โœ–

creative-serving.com

โœ–

creativecdn.com

โœ–

criteo.com

โœ–

bidder.criteo.com

โœ–

static.criteo.com

โœ–

crsspxl.com

โœ–

tag.crsspxl.com

โœ–

crwdcntrl.net

โœ–

tags.crwdcntrl.net

โœ–

ctnsnet.com

โœ–

curalate.com

โœ–

customer.io

โœ–

custora.com

โœ–

cxense.com

โœ–

cdn.cxense.com

โœ–

d1af033869koo7.cloudfront.net

โœ–

d2t77mnxyo7adj.cloudfront.net

โœ–

d395dw5zk780j2.cloudfront.net

โœ–

d41.co

โœ–

d9jj3mjthpub.cloudfront.net

โœ–

dable.io

โœ–

dailymotion.com

โœ–

datamind.ru

โœ–

dataxpand.com

โœ–

daum.net

โœ–

dc-storm.com

โœ–

ddos-guard.net

โœ–

demdex.net

โœ–

dpm.demdex.net

โœ–

lnkd.demdex.net

โœ–

mscom.demdex.net

โœ–

deployads.com

โœ–

tags-cdn.deployads.com

โœ–

deqwas.net

โœ–

detik.com

โœ–

dfapvmql-q.global.ssl.fastly.net

โœ–

dh014lg6uwepv.cloudfront.net

โœ–

di-dtaectolog-us-prod-1.appspot.com

โœ–

dialogtech.com

โœ–

digg.com

โœ–

widgets.digg.com

โœ–

diginetica.net

โœ–

digitaltarget.ru

โœ–

digitru.st

โœ–

disqus.com

โœ–

devhints.disqus.com

โœ–

dunebook.disqus.com

โœ–

ferrolho-github-io-blog.disqus.com

โœ–

jonloomer.disqus.com

โœ–

omgubuntu.disqus.com

โœ–

software-carpentry.disqus.com

โœ–

sunscrapers.disqus.com

โœ–

wuliuxiansheng.disqus.com

โœ–

districtm.io

โœ–

cdn.districtm.io

โœ–

dmpxs.com

โœ–

dmxleo.com

โœ–

docomo.ne.jp

โœ–

domeleco.top

โœ–

dotmetrics.net

โœ–

uk-script.dotmetrics.net

โœ–

dotomi.com

โœ–

purch-match.dotomi.com

โœ–

doubleclick.net

โœ–

ad.doubleclick.net

โœ–

googleads.g.doubleclick.net

โœ–

pubads.g.doubleclick.net

โœ–

securepubads.g.doubleclick.net

โœ–

stats.g.doubleclick.net

โœ–

static.doubleclick.net

โœ–

doublepimp.com

โœ–

dpmsrv.com

โœ–

dtscout.com

โœ–

dynamicyield.com

โœ–

cdn.dynamicyield.com

โœ–

cdn-eu.dynamicyield.com

โœ–

rcom.dynamicyield.com

โœ–

rcom-eu.dynamicyield.com

โœ–

st.dynamicyield.com

โœ–

st-eu.dynamicyield.com

โœ–

static.dynamicyield.com

โœ–

e-planning.net

โœ–

ebis.ne.jp

โœ–

eccmp.com

โœ–

effectivemeasure.net

โœ–

me-ssl.effectivemeasure.net

โœ–

el-mundo.net

โœ–

elfsight.com

โœ–

eloqua.com

โœ–

elsevier.com

โœ–

emxdgt.com

โœ–

cs.emxdgt.com

โœ–

enamad.ir

โœ–

engageya.com

โœ–

episerver.net

โœ–

essayprofit.com

โœ–

estat.com

โœ–

eum-appdynamics.com

โœ–

everesttech.net

โœ–

ats.everesttech.net

โœ–

evergage.com

โœ–

everyaction.com

โœ–

eviltracker.net

โœ–

exdynsrv.com

โœ–

exelator.com

โœ–

exosrv.com

โœ–

exponea.com

โœ–

eyeota.net

โœ–

eyereturn.com

โœ–

ezoic.net

โœ–

g.ezoic.net

โœ–

go.ezoic.net

โœ–

facebook.com

โœ–

s-static.ak.facebook.com

โœ–

api.facebook.com

โœ–

graph.facebook.com

โœ–

m.facebook.com

โœ–

staticxx.facebook.com

โœ–

www.facebook.com

โœ–

feathr.co

โœ–

feedify.net

โœ–

firebaselogging.googleapis.com

โœ–

firstimpression.io

โœ–

flashtalking.com

โœ–

flocktory.com

โœ–

force.com

โœ–

fout.jp

โœ–

franecki.net

โœ–

freeskreen.com

โœ–

freshrelevance.com

โœ–

fundraiseup.com

โœ–

fwmrm.net

โœ–

geetest.com

โœ–

geistm.com

โœ–

gemius.pl

โœ–

geniusmonkey.com

โœ–

getblue.io

โœ–

getblueshift.com

โœ–

getclicky.com

โœ–

getdrip.com

โœ–

getletterpress.com

โœ–

getrockerbox.com

โœ–

gigya.com

โœ–

giraff.io

โœ–

glassboxdigital.io

โœ–

gleam.io

โœ–

globalwebindex.net

โœ–

gmossp-sp.jp

โœ–

go.com

โœ–

godaddy.com

โœ–

google-analytics.com

โœ–

www.google-analytics.com

โœ–

google.com

โœ–

accounts.google.com

โœ–

adservice.google.com

โœ–

apis.google.com

โœ–

books.google.com

โœ–

calendar.google.com

โœ–

checkout.google.com

โœ–

0.client-channel.google.com

โœ–

clients1.google.com

โœ–

clients6.google.com

โœ–

consent.google.com

โœ–

cse.google.com

โœ–

datastudio.google.com

โœ–

developers.google.com

โœ–

docs.google.com

โœ–

drive.google.com

โœ–

feedburner.google.com

โœ–

feedproxy.google.com

โœ–

fonts.google.com

โœ–

fundingchoicesmessages.google.com

โœ–

fusiontables.google.com

โœ–

groups.google.com

โœ–

hangouts.google.com

โœ–

kh.google.com

โœ–

khms0.google.com

โœ–

khms1.google.com

โœ–

khms2.google.com

โœ–

khms3.google.com

โœ–

khms4.google.com

โœ–

labs.google.com

โœ–

mail.google.com

โœ–

maps.google.com

โœ–

maps-api-ssl.google.com

โœ–

mapsengine.google.com

โœ–

mt0.google.com

โœ–

mt1.google.com

โœ–

mts0.google.com

โœ–

mts1.google.com

โœ–

mw1.google.com

โœ–

mw2.google.com

โœ–

pay.google.com

โœ–

picasaweb.google.com

โœ–

play.google.com

โœ–

scholar.google.com

โœ–

sites.google.com

โœ–

smartlock.google.com

โœ–

spreadsheets.google.com

โœ–

suggestqueries.google.com

โœ–

talkgadget.google.com

โœ–

translate.google.com

โœ–

trends.google.com

โœ–

video.google.com

โœ–

www.google.com

โœ–

gridsumdissector.com

โœ–

growingio.com

โœ–

gsspat.jp

โœ–

gssprt.jp

โœ–

gstatic.com

โœ–

gumgum.com

โœ–

g2.gumgum.com

โœ–

js.gumgum.com

โœ–

hanmaker.com

โœ–

hcaptcha.com

โœ–

heapanalytics.com

โœ–

cdn.heapanalytics.com

โœ–

hexagon-analytics.com

โœ–

highwire.org

โœ–

hindustantimes.com

โœ–

histats.com

โœ–

s10.histats.com

โœ–

holder.com.ua

โœ–

hrzn-nxt.com

โœ–

hubspot.com

โœ–

api.hubspot.com

โœ–

app.hubspot.com

โœ–

cta-service-cms2.hubspot.com

โœ–

forms.hubspot.com

โœ–

js.hubspot.com

โœ–

meetings.hubspot.com

โœ–

no-cache.hubspot.com

โœ–

static.hubspot.com

โœ–

hushly.com

โœ–

hybrid.ai

โœ–

iadvize.com

โœ–

ibclick.stream

โœ–

id5-sync.com

โœ–

idio.co

โœ–

iesnare.com

โœ–

mpsnare.iesnare.com

โœ–

igodigital.com

โœ–

im-apps.net

โœ–

imhd.io

โœ–

impact-ad.jp

โœ–

imrworldwide.com

โœ–

cdn-gl.imrworldwide.com

โœ–

in-page-push.com

โœ–

infeed.id

โœ–

infinity-tracking.net

โœ–

influ2.com

โœ–

infolinks.com

โœ–

resources.infolinks.com

โœ–

informz.net

โœ–

innity.com

โœ–

innovid.com

โœ–

inpagepush.com

โœ–

inq.com

โœ–

inside-graph.com

โœ–

insightexpressai.com

โœ–

instagram.com

โœ–

insticator.com

โœ–

insurads.com

โœ–

intentiq.com

โœ–

intergient.com

โœ–

internetbrands.com

โœ–

investingchannel.com

โœ–

ioam.de

โœ–

script.ioam.de

โœ–

iocnt.net

โœ–

iperceptions.com

โœ–

ipredictive.com

โœ–

irs03.com

โœ–

ispot.tv

โœ–

iteratehq.com

โœ–

ivcbrasil.org.br

โœ–

ivideosmart.com

โœ–

izooto.com

โœ–

janrainsso.com

โœ–

jixie.io

โœ–

jsdelivr.net

โœ–

jsrdn.com

โœ–

justpremium.com

โœ–

jwpltx.com

โœ–

kakao.com

โœ–

kameleoon.eu

โœ–

kaptcha.com

โœ–

kargo.com

โœ–

keywee.co

โœ–

klangoo.com

โœ–

klarnaservices.com

โœ–

klarnauserservices.com

โœ–

knet.cn

โœ–

koddi.com

โœ–

kompas.com

โœ–

krxd.net

โœ–

ladsp.com

โœ–

leadlander.com

โœ–

lentainform.com

โœ–

lfeeder.com

โœ–

liadm.com

โœ–

idx.liadm.com

โœ–

lifesight.io

โœ–

lightboxcdn.com

โœ–

lijit.com

โœ–

ap.lijit.com

โœ–

likr.com.tw

โœ–

line.me

โœ–

linkconnector.com

โœ–

linkedin.com

โœ–

dc.ads.linkedin.com

โœ–

platform.linkedin.com

โœ–

linksynergy.com

โœ–

liputan6.id

โœ–

list-manage.com

โœ–

listrakbi.com

โœ–

livechatinc.com

โœ–

liveperson.net

โœ–

lkqd.net

โœ–

loadercdn.net

โœ–

loginhood.io

โœ–

logly.co.jp

โœ–

loopgift.com

โœ–

lww.com

โœ–

lytics.io

โœ–

macromill.com

โœ–

mail.ru

โœ–

mailchimp.com

โœ–

mailfire.io

โœ–

mantisadnetwork.com

โœ–

marinsm.com

โœ–

marketo.com

โœ–

marvellousmachine.net

โœ–

mateti.net

โœ–

matheranalytics.com

โœ–

js.matheranalytics.com

โœ–

mathtag.com

โœ–

maven.io

โœ–

mavencoalition.io

โœ–

maxymiser.net

โœ–

media.net

โœ–

contextual.media.net

โœ–

media6degrees.com

โœ–

mediaad.org

โœ–

mediacategory.com

โœ–

mediacorp.sg

โœ–

mediafuse.com

โœ–

mediav.com

โœ–

mediawallahscript.com

โœ–

medium.al

โœ–

medium.com

โœ–

cdn-client.medium.com

โœ–

glyph.medium.com

โœ–

miro.medium.com

โœ–

medtargetsystem.com

โœ–

mellowads.com

โœ–

mfadsrvr.com

โœ–

mgid.com

โœ–

jsc.mgid.com

โœ–

mia-chat.com

โœ–

miaozhen.com

โœ–

micpn.com

โœ–

microad.jp

โœ–

microadinc.com

โœ–

microsoft.com

โœ–

mindbox.ru

โœ–

mirror.co.uk

โœ–

mktoresp.com

โœ–

ml314.com

โœ–

mmstat.com

โœ–

moatads.com

โœ–

z.moatads.com

โœ–

monetate.net

โœ–

monsido.com

โœ–

mookie1.com

โœ–

mouseflow.com

โœ–

cdn.mouseflow.com

โœ–

mpeasylink.com

โœ–

mpianalytics.com

โœ–

mts.ru

โœ–

mtvnservices.com

โœ–

musthird.com

โœ–

myvisualiq.net

โœ–

myvoicenation.com

โœ–

najva.com

โœ–

nakanohito.jp

โœ–

nanda.vn

โœ–

nanorep.co

โœ–

narrative.io

โœ–

nativendo.de

โœ–

navdmp.com

โœ–

naver.com

โœ–

nbcuni.com

โœ–

netmng.com

โœ–

newmedia.az

โœ–

newrelic.com

โœ–

js-agent.newrelic.com

โœ–

newscgp.com

โœ–

newsmaxwidget.com

โœ–

ngpvan.com

โœ–

nine.com.au

โœ–

nosto.com

โœ–

notheredef.fun

โœ–

nr-data.net

โœ–

o-s.io

โœ–

ocdn.eu

โœ–

ojrq.net

โœ–

ok.ru

โœ–

okt.to

โœ–

okta.com

โœ–

olark.com

โœ–

olx-st.com

โœ–

omnitagjs.com

โœ–

omny.fm

โœ–

omtrdc.net

โœ–

amazoncustomerservice.d2.sc.omtrdc.net

โœ–

attservicesinc.tt.omtrdc.net

โœ–

dsw.tt.omtrdc.net

โœ–

microsoftmscompoc.tt.omtrdc.net

โœ–

onelink.me

โœ–

onetag-sys.com

โœ–

onevision.com.tw

โœ–

online-metrix.net

โœ–

onthe.io

โœ–

opecloud.com

โœ–

tagger.opecloud.com

โœ–

openx.net

โœ–

qaamgo-d.openx.net

โœ–

u.openx.net

โœ–

us-u.openx.net

โœ–

optimizely.com

โœ–

cdn.optimizely.com

โœ–

osano.com

โœ–

otm-r.com

โœ–

outbrain.com

โœ–

amplify.outbrain.com

โœ–

owneriq.net

โœ–

pages03.net

โœ–

pages04.net

โœ–

pardot.com

โœ–

parsely.com

โœ–

cdn.parsely.com

โœ–

paypal.com

โœ–

pbbl.co

โœ–

pcmag.com

โœ–

pconline.com.cn

โœ–

pdvacde.com

โœ–

pendo.io

โœ–

permutive.app

โœ–

petametrics.com

โœ–

photorank.me

โœ–

pinterest.com

โœ–

assets.pinterest.com

โœ–

ct.pinterest.com

โœ–

piwik.pro

โœ–

pixlee.com

โœ–

plista.com

โœ–

pointmediatracker.com

โœ–

popin.cc

โœ–

postaffiliatepro.com

โœ–

postrelease.com

โœ–

powerlinks.com

โœ–

px.powerlinks.com

โœ–

prcdn.co

โœ–

pressboard.ca

โœ–

prfct.co

โœ–

privacymanager.io

โœ–

privymktg.com

โœ–

pro-market.net

โœ–

ads.pro-market.net

โœ–

prod-mng-proxy-connext.azurewebsites.net

โœ–

programattik.com

โœ–

pub.network

โœ–

a.pub.network

โœ–

pubmatic.com

โœ–

ads.pubmatic.com

โœ–

pubstack.io

โœ–

pushnami.com

โœ–

pymx5.com

โœ–

qlitics.com

โœ–

qq.com

โœ–

captcha.qq.com

โœ–

photo.store.qq.com

โœ–

qualtrics.com

โœ–

quantserve.com

โœ–

pixel.quantserve.com

โœ–

secure.quantserve.com

โœ–

quantummetric.com

โœ–

queue-it.net

โœ–

quora.com

โœ–

a.quora.com

โœ–

www.quora.com

โœ–

r-ad.ne.jp

โœ–

rakuten.co.jp

โœ–

rakuten.com

โœ–

rambler.ru

โœ–

reactful.com

โœ–

realite.id

โœ–

realsrv.com

โœ–

recommendationengine.googleapis.com

โœ–

reddit.com

โœ–

reichelcormier.bid

โœ–

relap.io

โœ–

rentracks.jp

โœ–

research-int.se

โœ–

researchnow.com

โœ–

reson8.com

โœ–

retailrocket.net

โœ–

retargetly.com

โœ–

revcontent.com

โœ–

assets.revcontent.com

โœ–

revjet.com

โœ–

rezync.com

โœ–

rfihub.com

โœ–

rfksrv.com

โœ–

ria.ru

โœ–

richaudience.com

โœ–

richrelevance.com

โœ–

riskified.com

โœ–

riverhit.com

โœ–

rkdms.com

โœ–

mid.rkdms.com

โœ–

rlcdn.com

โœ–

api.rlcdn.com

โœ–

ats.rlcdn.com

โœ–

rmtag.com

โœ–

rnengage.com

โœ–

rtk.io

โœ–

rtmark.net

โœ–

rubiconproject.com

โœ–

ads.rubiconproject.com

โœ–

secure-assets.rubiconproject.com

โœ–

rumiview.com

โœ–

rutarget.ru

โœ–

sabavision.com

โœ–

salecycle.com

โœ–

salesforce.com

โœ–

salesforceliveagent.com

โœ–

salesloft.com

โœ–

samandehi.ir

โœ–

samba.tv

โœ–

sanjagh.com

โœ–

sas.com

โœ–

sc-static.net

โœ–

scarabresearch.com

โœ–

schibsted.com

โœ–

scorecardresearch.com

โœ–

sb.scorecardresearch.com

โœ–

scupio.com

โœ–

securedtouch.com

โœ–

securedvisit.com

โœ–

secureserver.net

โœ–

seedr.com

โœ–

seedtag.com

โœ–

config.seedtag.com

โœ–

segment.com

โœ–

cdn.segment.com

โœ–

sekindo.com

โœ–

semasio.net

โœ–

servebom.com

โœ–

ads.servebom.com

โœ–

serverbid.com

โœ–

serving-sys.com

โœ–

sessioncam.com

โœ–

seznam.cz

โœ–

sf14g.com

โœ–

sharethrough.com

โœ–

sdk.sharethrough.com

โœ–

shop.pe

โœ–

shopnetic.com

โœ–

sift.com

โœ–

cdn.sift.com

โœ–

siftscience.com

โœ–

cdn.siftscience.com

โœ–

simpli.fi

โœ–

site24x7rum.com

โœ–

siteimproveanalytics.io

โœ–

sitescout.com

โœ–

skimresources.com

โœ–

s.skimresources.com

โœ–

skplanet.com

โœ–

smadex.com

โœ–

smartadserver.com

โœ–

smartnews-ads.com

โœ–

smartocto.com

โœ–

smassets.net

โœ–

smct.co

โœ–

smi2.net

โœ–

smi2.ru

โœ–

snapchat.com

โœ–

snssdk.com

โœ–

sobot.com

โœ–

soflopxl.com

โœ–

sojern.com

โœ–

solosegment.com

โœ–

solvemedia.com

โœ–

sonobi.com

โœ–

purch-sync.go.sonobi.com

โœ–

sync.go.sonobi.com

โœ–

soundcloud.com

โœ–

api.soundcloud.com

โœ–

feeds.soundcloud.com

โœ–

w.soundcloud.com

โœ–

sp-prod.net

โœ–

speakol.com

โœ–

sphereup.com

โœ–

sphlabs.com

โœ–

spiceworks.com

โœ–

spokenlayer.com

โœ–

spot.im

โœ–

spotify.com

โœ–

embed.spotify.com

โœ–

open.spotify.com

โœ–

spotxchange.com

โœ–

sync.search.spotxchange.com

โœ–

springserve.com

โœ–

sputnik.ru

โœ–

stack-sonar.com

โœ–

www.stack-sonar.com

โœ–

stackadapt.com

โœ–

stackoverflow.com

โœ–

stat.media

โœ–

statad.ru

โœ–

statcounter.com

โœ–

www.statcounter.com

โœ–

steelhousemedia.com

โœ–

stickyadstv.com

โœ–

storage.googleapis.com

โœ–

streamable.com

โœ–

streamtheworld.com

โœ–

stripe.com

โœ–

stripe.network

โœ–

m.stripe.network

โœ–

studiostack.com

โœ–

summerhamster.com

โœ–

www.summerhamster.com

โœ–

sumo.com

โœ–

sundaysky.com

โœ–

surfcountor.com

โœ–

surveymonkey.com

โœ–

swiftype.com

โœ–

taboola.com

โœ–

c2.taboola.com

โœ–

cdn.taboola.com

โœ–

tagboard.com

โœ–

tagcommander.com

โœ–

tailtarget.com

โœ–

tamgrt.com

โœ–

tapad.com

โœ–

targetspot.com

โœ–

tavoos.net

โœ–

tawk.to

โœ–

teads.tv

โœ–

sync.teads.tv

โœ–

tealiumiq.com

โœ–

techhub.co.kr

โœ–

techlab-cdn.com

โœ–

technoratimedia.com

โœ–

techtarget.com

โœ–

techweb.com

โœ–

tenmax.io

โœ–

terminus.services

โœ–

tfaforms.net

โœ–

theadex.com

โœ–

thebrighttag.com

โœ–

thrtle.com

โœ–

thunderhead.com

โœ–

tidaltv.com

โœ–

tiktok.com

โœ–

timecommerce.net

โœ–

tinypass.com

โœ–

tiqcdn.com

โœ–

tns-counter.ru

โœ–

tns-ua.com

โœ–

toast.com

โœ–

top100.ru

โœ–

trackersimulator.org

โœ–

tradedoubler.com

โœ–

tradelab.fr

โœ–

tradingview.com

โœ–

trafficbass.com

โœ–

trafficjunky.net

โœ–

trafmag.com

โœ–

treasuredata.com

โœ–

tremorhub.com

โœ–

qds0l.publishers.tremorhub.com

โœ–

trendemon.com

โœ–

tribalfusion.com

โœ–

tribl.io

โœ–

trkn.us

โœ–

truehits.in.th

โœ–

truepush.com

โœ–

trumba.com

โœ–

trustarc.com

โœ–

consent.trustarc.com

โœ–

trustedsite.com

โœ–

tsyndicate.com

โœ–

turn.com

โœ–

tvpixel.com

โœ–

tvsquared.com

โœ–

twimg.com

โœ–

twitch.tv

โœ–

player.twitch.tv

โœ–

twitter.com

โœ–

platform.twitter.com

โœ–

syndication.twitter.com

โœ–

tynt.com

โœ–

typekit.net

โœ–

udesk.cn

โœ–

udmserve.net

โœ–

ufpcdn.com

โœ–

uicdn.net

โœ–

undertone.com

โœ–

unrulymedia.com

โœ–

unsplash.com

โœ–

useinsider.com

โœ–

usercentrics.eu

โœ–

usergram.info

โœ–

userreplay.net

โœ–

utarget.ru

โœ–

uxfeedback.ru

โœ–

valuecommerce.com

โœ–

viafoura.co

โœ–

api.viafoura.co

โœ–

videohub.tv

โœ–

vidible.tv

โœ–

vidio.com

โœ–

vidyard.com

โœ–

viglink.com

โœ–

vihub.ru

โœ–

vimeo.com

โœ–

player.vimeo.com

โœ–

vindicosuite.com

โœ–

visualstudio.com

โœ–

visualwebsiteoptimizer.com

โœ–

vk.com

โœ–

vmmpxl.com

โœ–

voltn.com

โœ–

pixel.voltn.com

โœ–

voxmedia.com

โœ–

w55c.net

โœ–

wbtrk.net

โœ–

wcfbc.net

โœ–

wdsvc.net

โœ–

webantenna.info

โœ–

webengage.com

โœ–

webflow.com

โœ–

weborama.fr

โœ–

webspectator.com

โœ–

webterren.com

โœ–

webtrekk.net

โœ–

webvisor.org

โœ–

wemfbox.ch

โœ–

wi-fi.ru

โœ–

widerplanet.com

โœ–

wishabi.com

โœ–

wistia.net

โœ–

wkxppshj-qx.global.ssl.fastly.net

โœ–

wp.com

โœ–

wsod.com

โœ–

wt-eu02.net

โœ–

xg4ken.com

โœ–

xiti.com

โœ–

xlisting.jp

โœ–

yadro.ru

โœ–

yahoo.co.jp

โœ–

yahoo.com

โœ–

ups.analytics.yahoo.com

โœ–

y3.analytics.yahoo.com

โœ–

pipes.yahoo.com

โœ–

search.yahoo.com

โœ–

yandex.com

โœ–

yandex.ru

โœ–

an.yandex.ru

โœ–

api-maps.yandex.ru

โœ–

img-fotki.yandex.ru

โœ–

mc.yandex.ru

โœ–

yektanet.com

โœ–

yellowblue.io

โœ–

yieldlab.net

โœ–

yieldmo.com

โœ–

yieldoptimizer.com

โœ–

yoox.it

โœ–

yotpo.com

โœ–

youtube-nocookie.com

โœ–

www.youtube-nocookie.com

โœ–

youtube.com

โœ–

www.youtube.com

โœ–

youvisit.com

โœ–

yunaq.com

โœ–

zalo.me

โœ–

zdbb.net

โœ–

zedo.com

โœ–

zemanta.com

โœ–

zendesk.com

โœ–

zeotap.com

โœ–

zergnet.com

โœ–

zoho.com

โœ–

zoominfo.com

โœ–

ws.zoominfo.com

โœ–

zprk.io

โœ–

"""

Use String[] not Any[].

2 Likes

After I changed to a = String[];
still not performant.

  0.002423 seconds (9.30 k allocations: 388.562 KiB)
  0.002170 seconds (9.30 k allocations: 388.562 KiB)
  0.001114 seconds (9.30 k allocations: 388.562 KiB)

String is โ€œwhateverโ€ โ€“ you canโ€™t do anything much better in any language. But I guess you can at least reduce allocation a bit.

Not to mention weโ€™re also spending like 30% of time writing to IO line by line, who knows how Python / Julia do buffer differently.

(reminds me of a test of printing 10^5 lines, pythons is significantly faster than a lot of languages because it prints multiple lines together instead of โ€œflushโ€ the IO every single time


 function func1(strd)
           URLS = split(replace(strd, "\n" => ""), "โœ–")
           filter!(occursin("."), URLS)
           trackers = open("trackers.txt", "w");
           write(trackers, join(URLS,"\n"))
           #print("Successfully completed\n");
           nothing
       end
func (generic function with 1 method)


julia> @btime func1($bigstring)
  209.628 ฮผs (32 allocations: 122.61 KiB)

julia> function func2(strd)
           a = String[];
           for url in split(replace(strd, "\n" => ""), "โœ–")
               if occursin(".",url)
                   push!(a, url);
               end
           end
           trackers = open("trackers.txt", "w");
           for url in a
               write(trackers, url*"\n");
           end
           close(trackers);
           #print("Successfully completed\n");
       end
func (generic function with 1 method)

julia> @btime func2($bigstring)
  434.133 ฮผs (3122 allocations: 294.19 KiB)
3 Likes

Approaching this from another angle,

julia> @btime [m.match for m in eachmatch(r"\S*\.\S*", $bigstring)]
  272.699 ฮผs (3096 allocations: 321.44 KiB)
1028-element Array{SubString{String},1}:
 "1dmp.io"
 "1rx.io"
 "sync.1rx.io"
 "247-inc.net"
6 Likes

Thank you :slight_smile: Its alot shorter version.

I found,
btime isnโ€™t available in my 1.4.1 version julia. using @time instead and according to your code


function func(strd)
    cur = [m.match for m in eachmatch(r"\S*\.\S*", bigstring)]


    trackers = open("trackers.txt", "w");
    for url in cur
        write(trackers, url*"\n");
    end
    close(trackers);
    print("Successfully completed\n");
end

@time func(bigstring) 

0.003284 seconds (5.17 k allocations: 312.438 KiB)
0.002035 seconds (5.17 k allocations: 312.438 KiB)
:slight_smile: It have less allocations than mine, but performance remains pretty much same

I used GitHub - JuliaCI/BenchmarkTools.jl: A benchmarking framework for the Julia language , there i found @btime but It takes more iterations and gives min taken time after taking some iterations.
Although i used

@btime func(bigstring)
  312.398 ฮผs (5168 allocations: 312.42 KiB)
  # 0.000312398 seconds 

and I also tried to use with python giving some iterations,

times = []

for i in range(1, 100):
    start_time = time.time()
    main(bigstring)
    times.append((time.time() - start_time))
print(min(times))

# result: 0.00029277801513671875

@jling Thank you for your answer. In `func1` , your code says there is syntax mistake in ``` filter!(occursin("."), URLS) ``` I am also bit nervous, that is it ok to do not use `close()` after writing file.

Suprised In file writing/reading python is fast than other languages. I also tried to restart kernel and run it again having same results. May be this one was reason.
But Still I need concrete solutionโ€ฆ

Iโ€™m getting roughly 2x speedup vs the original function with

function func(strd)
   a = (url for url in split(replace(strd, '\n' => ""), "โœ–") if occursin('.', url))
   open("trackers.txt", "w") do io
       for url in a
           write(io, url,'\n');
       end
   end
   print("Successfully completed\n");
end
1 Like

@stillyslalom, excellent regex solution. Tried to do the same using ReadableRegex.jl as follows:

function func3(strd::String)
    reg = one_or_more(NON_WHITESPACE) * exactly(1,".") * one_or_more(NON_WHITESPACE)
    [m.match for m in eachmatch(reg, strd)]
end

using BenchmarkTools, ReadableRegex
include("bigstring.jl");
@btime func3($bigstring)
  283.800 ฮผs (3122 allocations: 322.50 KiB)
1028-element Array{SubString{String},1}:
 "1dmp.io"
 "1rx.io"
 "sync.1rx.io"
 "247-inc.net"
 "2o7.net"
 "112.2o7.net"
 โ‹ฎ
 "zergnet.com"
 "zoho.com"   
 "zoominfo.com"
 "ws.zoominfo.com"
 "zprk.io"

PS: using in this case exactly(1,".") or one_or_more(".") seems to produce the same result

2 Likes

:slight_smile: Thanks @vasily,

I tried to use btime to benchmark your result.for 4 times, time had decreased but not as fast as i comparedโ€ฆ


  674.228 ฮผs (2091 allocations: 120.41 KiB)
  334.126 ฮผs (2091 allocations: 120.41 KiB)
  344.855 ฮผs (2091 allocations: 120.41 KiB)
  342.859 ฮผs (2091 allocations: 120.41 KiB)

and using @time for 3 time

  0.018397 seconds (7.04 k allocations: 379.798 KiB)
  0.018803 seconds (7.04 k allocations: 379.798 KiB)
  0.018452 seconds (7.04 k allocations: 379.798 KiB)

But I am still not getting that performance than other i compared.


Thank you @rafael.guerra , I am looking at ReadableRegex.jl to learn about it. :slightly_smiling_face:
Although It was short I tried to benchmark my for loops, which i feel easy :slight_smile: although It takes alot of allocations and time as same.

function func(strd)
    a = Any[];
    for url in split(replace(strd, "\n" => ""), "โœ–")
        if occursin(".",url)
            push!(a, url);
        end
    end
end

and using

@btime func(bigstring)


  287.172 ฮผs (7226 allocations: 312.72 KiB)
  284.439 ฮผs (7226 allocations: 312.72 KiB)

I am looking for speeding my original cleaning and file reading and writing function using performance tips.
I still thinking why python is fast in this situation even Julia is compiled and fast as C .

From your example it looks like the replace and occursin are really only needed in the very beginning and end. If this is the case generally then the following should be faster.

function func2(strd)
    a = split(strd, 'โœ–')
    a = strip.(a)
    filter!(!isempty, a)
    trackers = open("trackers.txt", "w");
    for url in a
        write(trackers, url, "\n");
    end
    close(trackers);
end
2 Likes

Yes, This is similar to what i wanted.
using @btime got,

233.651 ฮผs (5102 allocations: 168.94 KiB)
226.176 ฮผs (5102 allocations: 168.94 KiB)
226.783 ฮผs (5102 allocations: 168.94 KiB)
232.102 ฮผs (5102 allocations: 168.94 KiB)


Also tested `@time` got ```
 0.000709 seconds (5.10 k allocations: 168.938 KiB)
  0.001105 seconds (5.10 k allocations: 168.938 KiB)
  0.001116 seconds (5.10 k allocations: 168.938 KiB)
  0.001291 seconds (5.10 k allocations: 168.938 KiB)
  0.000672 seconds (5.10 k allocations: 168.938 KiB)

time was fluctuation everytime i run


``` with Minimum time to second got :`0.000226 seconds`

which is same as unoptimized version in python.

0.00028586387634277344
0.0002853870391845703
0.0002918243408203125

But It is good. Subtracting them got julia faster in
0.0002853870391845703 - 0.000226 = 0.00005938703

Got 59.387030 microsecond speedup than Python.
But I am still unable to figure out slowness without optimizing even comparing it with python.

(I know It is fast, but I am still not getting it)

Well, if you argue that the timings you get are not โ€œas fast as Cโ€, do you have a reference C implementation to confirm that?

In both Python and Julia, you use high-level string manipulation and I/O functions. Thereโ€™s no reason to assume split or contains in Python is much slower than in Julia because the latter uses an optimized C implementation under the hood (chances are, it is faster because thereโ€™s been more time to polish the underlying implementations).

When people say โ€œJulia is as fast as Cโ€, that usually refers to low-level operations on primitive types, which is not the case here.

Other things that might be worth considering:

  • How often do you need to perform such kind of operation? If it is once in a lifetime, wouldnโ€™t be your time better spent on something other than making one function run 50 ฮผs faster?
  • If it should run multiple times, how are input strings constructed? If they are read from disk/network, shouldnโ€™t that be included into the benchmark as well? I mean, constructing a string from some bytes you read takes some time as well, so that benchmarking on a pre-constructed string might not reflect the real situation (I donโ€™t now if it does matter, but Julia strings are basically raw UTF8-encoded bytes, while Python uses fixed-width 1-, 2- or 4-byte chars, so that decoding a string from a file may add a measurable overhead).
5 Likes

:slight_smile: I was not arguing about C. I was only concerned with performance between julia and python .
Because of Python seen speedy in this my specific problem, so I posted. I was just comparing them, although not real world cases.

But,
As you told, Because of

May be this is solution

1 Like