<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://longxi7997.github.io/</id>
    <title>longxi7997</title>
    <updated>2021-07-27T02:32:10.379Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://longxi7997.github.io/"/>
    <link rel="self" href="https://longxi7997.github.io/atom.xml"/>
    <subtitle>温故而知新</subtitle>
    <logo>https://longxi7997.github.io/images/avatar.png</logo>
    <icon>https://longxi7997.github.io/favicon.ico</icon>
    <rights>All rights reserved 2021, longxi7997</rights>
    <entry>
        <title type="html"><![CDATA[Python性能优化]]></title>
        <id>https://longxi7997.github.io/post/python性能优化/</id>
        <link href="https://longxi7997.github.io/post/python性能优化/">
        </link>
        <updated>2021-07-20T08:21:08.000Z</updated>
        <content type="html"><![CDATA[<p><a href="https://www.cnblogs.com/venvive/p/11601190.html">https://www.cnblogs.com/venvive/p/11601190.html</a></p>
<h1 id="性能评价分析">性能评价分析</h1>
<ol>
<li>
<h3 id="timedatetimearrowtimeperf_countertimeitdefault_timer计时">time|datetime|arrow|time.perf_counter()|timeit.default_timer计时</h3>
<p>low</p>
</li>
<li>
<h3 id="timeit">timeit</h3>
<p>总结：直接看模块化和default_timer()</p>
<ol>
<li>
<h4 id="单行测试">单行测试</h4>
<pre><code class="language-python">import timeit
print(timeit.timeit('a=1'))
print(timeit.repeat('a=1')) #默认五次，输出数组
</code></pre>
</li>
<li>
<h4 id="多行测试">多行测试</h4>
<pre><code class="language-python">import timeit

print(timeit.timeit(stmt='a=1;b=2;c=a+b;'))
print(timeit.timeit(stmt=&quot;&quot;&quot;
a=1;
b=2;
c=a+b;
&quot;&quot;&quot;))
</code></pre>
</li>
<li>
<h4 id="模块化">模块化</h4>
<p>建议加上重复次数，排除引入的影响</p>
<pre><code class="language-python">import timeit
import random

# 本地函数
def func1():
    return random.randint(1, 10)

# 依赖其他函数
def func2():
    return func1()


print(timeit.timeit('func1()', setup='from __main__ import func1'))
print(timeit.timeit('func2()', setup='from __main__ import func2',number=100))
</code></pre>
</li>
</ol>
</li>
<li>
<h3 id="time-装饰器">time() 装饰器</h3>
</li>
<li>
<h3 id="profile">profile</h3>
</li>
<li>
<h3 id="cprofile">cProfile</h3>
</li>
<li>
<h3 id="line_profiler">line_profiler</h3>
</li>
<li>
<h3 id="memory_profiler">memory_profiler</h3>
</li>
<li>
<h3 id="pycharm">PyCharm</h3>
</li>
<li>
<p>pycallgraph</p>
</li>
<li>
<h3 id="objgraph">objgraph</h3>
</li>
</ol>
<h1 id="性能优化的几种情况">性能优化的几种情况</h1>
<h2 id="计算密集型">计算密集型</h2>
<p>GIL</p>
<p>JIT</p>
<h2 id="io密集型">IO密集型</h2>
<p>hiredis</p>
]]></content>
    </entry>
    <entry>
        <title type="html"><![CDATA[Hello Gridea]]></title>
        <id>https://longxi7997.github.io/post/hello-gridea/</id>
        <link href="https://longxi7997.github.io/post/hello-gridea/">
        </link>
        <updated>2018-12-11T16:00:00.000Z</updated>
        <summary type="html"><![CDATA[<p>👏  欢迎使用 <strong>Gridea</strong> ！<br>
✍️  <strong>Gridea</strong> 一个静态博客写作客户端。你可以用它来记录你的生活、心情、知识、笔记、创意... ...</p>
]]></summary>
        <content type="html"><![CDATA[<p>👏  欢迎使用 <strong>Gridea</strong> ！<br>
✍️  <strong>Gridea</strong> 一个静态博客写作客户端。你可以用它来记录你的生活、心情、知识、笔记、创意... ...</p>
<!-- more -->
<p><a href="https://github.com/getgridea/gridea">Github</a><br>
<a href="https://gridea.dev/">Gridea 主页</a><br>
<a href="http://fehey.com/">示例网站</a></p>
<h2 id="特性">特性👇</h2>
<p>📝  你可以使用最酷的 <strong>Markdown</strong> 语法，进行快速创作</p>
<p>🌉  你可以给文章配上精美的封面图和在文章任意位置插入图片</p>
<p>🏷️  你可以对文章进行标签分组</p>
<p>📋  你可以自定义菜单，甚至可以创建外部链接菜单</p>
<p>💻  你可以在 <strong>Windows</strong>，<strong>MacOS</strong> 或 <strong>Linux</strong> 设备上使用此客户端</p>
<p>🌎  你可以使用 <strong>𝖦𝗂𝗍𝗁𝗎𝖻 𝖯𝖺𝗀𝖾𝗌</strong> 或 <strong>Coding Pages</strong> 向世界展示，未来将支持更多平台</p>
<p>💬  你可以进行简单的配置，接入 <a href="https://github.com/gitalk/gitalk">Gitalk</a> 或 <a href="https://github.com/SukkaW/DisqusJS">DisqusJS</a> 评论系统</p>
<p>🇬🇧  你可以使用<strong>中文简体</strong>或<strong>英语</strong></p>
<p>🌁  你可以任意使用应用内默认主题或任意第三方主题，强大的主题自定义能力</p>
<p>🖥  你可以自定义源文件夹，利用 OneDrive、百度网盘、iCloud、Dropbox 等进行多设备同步</p>
<p>🌱 当然 <strong>Gridea</strong> 还很年轻，有很多不足，但请相信，它会不停向前 🏃</p>
<p>未来，它一定会成为你离不开的伙伴</p>
<p>尽情发挥你的才华吧！</p>
<p>😘 Enjoy~</p>
]]></content>
    </entry>
    <entry>
        <title type="html"><![CDATA[图数据库Neo4j]]></title>
        <id>https://longxi7997.github.io/post/neo4j简介/</id>
        <link href="https://longxi7997.github.io/post/neo4j简介/">
        </link>
        <updated>2016-01-15T04:30:26.000Z</updated>
        <content type="html"><![CDATA[<h1 id="图数据库-neo4j简介">图数据库-Neo4j简介</h1>
<p><a href="http://console.neo4j.org/">在线演示地址</a></p>
<h1 id="1-neo4j的亮点">1、Neo4j的亮点</h1>
<p>作为一款强健的，可伸缩的高性能数据库，Neo4j<br>
最适合完整的企业部署或者用于一个轻量级项目中完整服务器的一个子集存在。<br>
它包括如下几个显著特点:</p>
<blockquote>
<p>完整的ACID支持：一个事务里面多个操作同时发生，保证数据一致性</p>
</blockquote>
<blockquote>
<p>高可用性：可靠，性能只受硬件影响，不受业务本身约束。</p>
</blockquote>
<blockquote>
<p>轻易拓展到上亿级别的节点和关系：可进行分布式集群部署</p>
</blockquote>
<h1 id="2-什么是图数据库">2、什么是图数据库</h1>
<h2 id="21-什么是图数据库">2.1 什么是图数据库</h2>
<pre><code>图数据库用图来存储数据，是最接近高性能的一种用于存储数据的数据结构方式之一。
</code></pre>
<ul>
<li>
<p>节点（Node）：</p>
<ul>
<li>labels、properties</li>
</ul>
</li>
<li>
<p>关系（Relationship）：</p>
<ul>
<li>
<p>types、properties、direction</p>
</li>
<li>
<p>can have relationhips to itself</p>
</li>
<li>
<figure data-type="image" tabindex="1"><img src="https://longxi7997.github.io//post-images/1626663105987.png" alt="relation toitself" loading="lazy"></figure>
</li>
<li>
<div style="text-align: center;">relation to
itself</div>
</li>
<li>
<p>types、properties、direction</p>
</li>
<li>
<p>key-value；key（null is valid），values（not null）</p>
</li>
<li>
<p>numeric、string、boolean</p>
</li>
</ul>
</li>
<li>
<p>标签（Label）：</p>
<ul>
<li>
<p>assign roles and types to nodes</p>
</li>
<li>
<p>when defining constraints and adding indexes for properties</p>
</li>
<li>
<p>can be added and removed during runtime, can be uesd to mark temporary<br>
states for your nodes</p>
</li>
<li>
<p>labes have an id space of a int - roughly 2 billion</p>
</li>
<li>
<figure data-type="image" tabindex="2"><img src="https://longxi7997.github.io//post-images/1626663946748.png#pic_center" alt="Nodes andrelationships" loading="lazy"></figure>
</li>
<li>
<div style="text-align: center;">Nodes and relationships</div>
</li>
</ul>
</li>
<li>
<p>遍历(Traversal)：</p>
<ul>
<li>
<p>in most cases only a subgraph is visited</p>
</li>
<li>
<p>Cypher provide a way to query the graph</p>
</li>
<li>
<p>depth-first( default ) 、 width-first</p>
</li>
</ul>
</li>
<li>
<p>路径(Path)</p>
</li>
<li>
<p>模式(Schema)</p>
<ul>
<li>schema commands can only be applied on the master machine in a Neo4j<br>
cluster</li>
</ul>
</li>
<li>
<p>索引(Index)</p>
<ul>
<li>
<p>speed up queries</p>
</li>
<li>
<p>look at logs for clues to drop or recreate the index</p>
</li>
<li>
<p>you can use indexes through the different APIs,except Cypher</p>
</li>
<li>
<p>Neo4j use Constraints through different APIs to keep your data clean</p>
</li>
</ul>
</li>
</ul>
<h2 id="22-对比其他数据库模型">2.2 对比其他数据库模型</h2>
<ul>
<li>
<p>a graph database transforms a RDBMS</p>
<ul>
<li><img src="https://longxi7997.github.io//post-images/1626663983367.png" alt="RDBMS" loading="lazy"></li>
</ul>
</li>
</ul>
<div style="text-align: center;">RDBMS</div>
<figure data-type="image" tabindex="4"><img src="https://longxi7997.github.io//post-images/1626664178072.png" alt="Graph Database asRDBMS" loading="lazy"></figure>
<div style="text-align: center;">Graph Database as
RDBMS</div>
<ul>
<li>a graph database elaborates a Key-Value store</li>
</ul>
<figure data-type="image" tabindex="5"><img src="https://longxi7997.github.io//post-images/1626664013141.png" alt="Key-ValueStore" loading="lazy"></figure>
<div style="text-align: center;">Key-Value
    Store</div>
<figure data-type="image" tabindex="6"><img src="https://longxi7997.github.io//post-images/1626664235218.png" alt="Graph Database as Key-ValueStore" loading="lazy"></figure>
<div style="text-align: center;">Graph Database as Key-Value
Store</div>
<ul>
<li>
<p>a graph database relates Column-Family</p>
<ul>
<li>Column Family(BigTable-style) databases are an evolution of key-value,<br>
using “families” to allow grouping of rows. Stored in a graph, the<br>
families could become hierarchical, and the relationships among data<br>
becomes explicit.</li>
</ul>
</li>
<li>
<p>a graph database navigate a document store</p>
<ul>
<li>The container hierarchy of a document database accommodates nice,<br>
schema-free data that can easily be represented as a tree. Which is of<br>
course a graph. Refer to other documents (or document elements) within<br>
that tree and you have a more expressive representation of the same<br>
data. When in Neo4j, those relationships are easily navigable.</li>
<li><img src="https://longxi7997.github.io//post-images/1626664041343.png" alt="DocumentStore" loading="lazy"></li>
</ul>
</li>
</ul>
<div style="text-align: center;">Document
        Store
Store</div>
<figure data-type="image" tabindex="8"><img src="https://longxi7997.github.io//post-images/1626664056458.png" alt="Graph Database as DocumentStore" loading="lazy"></figure>
<div style="text-align: center;">Graph Database as Document
Store</div>]]></content>
    </entry>
</feed>